lets take it one thing at a time.
first, please, please, have mercy and name stuff uniquely.
you can use better names than I do here but anything is better than name collision... eg:
void vjello(string joy_in)
{
jello = joy_in;
}
string sjoy()
{
return jello;
}
and then you can add this
string jello;
under the private parts of your class.
If that does not work, repost your new code and ask again, explaining exactly what you want it to do and we will get it working.
Why don't you explain in plain English what you want to do.
For example the use of template makes no sense since you don't use it.
Also it would be better if you have meaningful and consistent names vector<cookies> aVector(5);
What are cookies?
#include <iostream>
#include <vector>
#include <string>
class Foo
{
std::string word;
public:
Foo( constchar* w );
friend std::ostream & operator<< ( std::ostream &, const Foo& );
};
std::ostream & operator<< ( std::ostream & out, const Foo& foo )
{
out << foo.word;
return out;
}
Foo::Foo( constchar* w )
: word( w )
{
}
class Bar
{
std::vector<Foo> foos;
public:
Bar();
void print() const;
};
Bar::Bar()
: foos( {"Hello", "Dolly", "world"} )
{
}
void Bar::print() const
{
for ( auto f : foos ) std::cout << f << ' ';
}
int main()
{
Bar bar;
bar.print();
}
We do create one object on line 44. We do use its default constructor, but we have rewritten that constructor to initialize member vector of Bar with three words.
The member vector of Bar has elements of type Foo. Foo has non-default constructor that uses its argument to initialize the string member of Foo.
But you're making it hard for anyone to help you, because you are ignoring people's questions.
They're even ignoring the questions about why they're ignoring questions.
It seems they're only interested in copying and pasting chunks of broken code into the thread, until someone just writes the code for them, so they can hand it in.
sorry if im not asking questions im scared its due soon ill try to but im new please forgive me
about the cookies i thought i could put anything in there but its the class sorry a little stressed
Your game2 HAS 5 game2's. Each of them HAS 5 game2's. Each of them HAS 5 game2's. Each of them HAS 5 game2's. Each of them HAS 5 game2's. Each of them HAS 5 game2's. Each of them HAS 5 game2's. Each of them HAS 5 game2's. ...
That is infinite recursion. That is not possible.
Lines 42-46 are syntactically function calls. That is not possible in class definition.
Which operator do you declare on line 22? Whitespace is not a valid operator.
Why are you sorry that you don't ask questions? Others have pointed out that you don't answer questions. Totally different problem.