Do I need pointers to the objects?
class B
{
private:
int x;
public:
B() {};
B(int a)
{x = a;}
~B() {}
int size() {
return x;
}
void add() {
x++;
}
};
class A
{
private:
B b;
public:
A() {}
~A() {}
A(B b2){
this->b = b2;
}
int size(){
return b.size();
}
};
int main()
{
B b(3);
A a(b);
b.add();
cout << b.size() << endl; //4
cout << a.size() << endl; //3
}