You are not allowed to create member variables in a class declaration. Justification are member variables that should not be used until the element has been built in any case, so they must be created in the constructor.
, Box() : x (0), y (0) {} . , ++ no-argument ( , ). Box, , . : Box, - Box . .
- . , , , , , .
class Box {
public:
int x,y;
Box(int xcoord, int ycoord){printf("I'm a box."); x = xcoord; y = ycoord;}
};
class Circle{
Box b;
Circle() : b(0,0) {printf("I'm a circle.");}
};