Sorry if this has been asked before, I can't seem to find anything. I'm not sure how to search for this.
I have something like this:
class A {
private:
int x;
int y;
public:
A(int, int);
}
class B {
private:
A a(3, 4); // Doesn't compile because of this line
public:
B();
}
The only way I could think to solve this was making a
a pointer to A
and then do a = new A(3, 4);
inside B
's constructor. But I don't want a
to be a pointer.
What's the correct way to solve this?