Mail Archives: djgpp/1999/01/01/09:56:32.1
That would be something like this:
class BASIC
{
private: // Lots of variables here...
public:
BASIC( int a, int b);
};
class NOTSOBASIC
{
private:
BASIC b1(1, 2);
BASIC b2(3,4);
public:
NOTSOBASIC() { /* how to init b1 and b2? */ }
};
Ofcourse it isn't really handy to declare the object with fixed parameters
like this. You could make a constructor BASIC::BASIC() - *without*
parameters - and do the handle handling from a separet method, like this:
class BASIC
{
private: // Lots of variables here...
int ba, int bb;
public:
BASIC();
Create( int a, int b);
};
BASIC::Create(int a, int b)
{
ba = a;
bb = b;
}
class NOTSOBASIC
{
private:
BASIC b1;
BASIC b2;
public:
NOTSOBASIC(int a, int b)
};
NOTSOBASIC::NOTSOBASIC(int a, int b)
{
b1.Create(a, b);
b2.Create(a, b);
}
Floris
- Raw text -