Okay, I've got two classes: Class1, and Class2. Class1 has no arguments in its constructor, Class2 has one integer argument.
How can I declare an instance of Class2 within Class1?
The code for Class2 cannot be modified, because I want it to be completely independent of Class1.
Heres what I have so far...
--------------------------------------------------------------
class Class2
{
private:
...private members...
public:
Class2(int);
...public members...
};
Class2::Class2(int)
{
[-some member integer-] = int;
}
class Class1
{
private:
Class2 className(25); //<-----error here
...private members...
oublic:
...public members...
};
--------------------------------------------------------------
I get an error on the line of the declaration of Class2.
( error C2059: syntax error : 'constant' )
I had a feeling that the class2 declaration should be this:
------> Class2 className(int);
But then somewhere (class1 constructor?) the class2 declaration would need an integer to create an instance.
I've been tryin a lot of stuff but i dont know the syntax. If anyone knows the syntax, that'd be great... just remember, the code for class2 is in a headerfile, and should be totally independant of class1.
-GhostAgent