Always initialize all fields in a constructor.
struct CC
{
int n;
char c;
};
class Point{
public:
Point(int newx, int newy);
private:
int x;
int y;
CC myStructure;
};
Point::Point(int newx, int newy) : x(newx), y(newy) {
myStructure.n = 1;
myStructure.c = 'a';
}
|
|