I'm getting the above error while experimenting with the stuff below.
I followed some teachign material examples that use the classes in the exact same way but when I try to make my own simple project it doesn't work.
The point was to build a beginners input stream on my own then have it push that value into a vector.
I created object User(n).
Object User(n) will be returned in my function list_strm::get().
In main I want to set object User Main=(the return value of ls.get())
List_strm ls, was created to accept that input as mentioned above.
That is similar to the error as in this code below?
The thing that's bothering me is that both of these examples, the one included below and the one I posted to start this thread, come from a book and I think I am doing them exactly the same... In the book it shows the code is supposed to run fine...
javascript:post1064708.edit()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
struct Date{
int y;
int m;
int d;
Date(int y , int m , int d );
};
int main()
{
Date today={1978,6,25};
cout<<today.m<<"\n"<< today.d<< "\n"<<today.y;
}
The example below is what I based my List_strm class code on.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
class Token_stream {
public:
Token_stream(); // make a Token_stream that reads from cin
//..........
};
Token_stream ts; // provides get() and putback()
int thisexampleis valid():
{
Token t = ts.get();
//.....
}