"Someonekicked" <so***********@comcast.net> wrote...
this is example of what is going on my program, and the error im getting :
when i try to compile the following :
#include <iostream>
using namespace std;
class first {
public:
first(int max) { };
Lose the extraneous semicolon.
};
class whatever {
public:
whatever() { };
Lose the extraneous semicolon.
private:
first sowhat(2);
What are you trying to accomplish? Are you trying to define a member
and initialise it here? You can't. Initialisation is done in the
constructor. Now, you wrote a default constructor and it does nothing
in your case. Why do you think you need it, then?
};
I get the error, syntax error : 'constant'
any ideas to solve it?
Yes. How about your book, doesn't it tell you how to initialise members
in the constructor?
class whatever { ...
whatever() : sowhat(2) {}
...
};
Recently there were such basic questions here I am wondering whether
some folks lost the ability to absorb necessary knowledge from books
altogether. Present company excluded, of course...
V