class a
{
private:
b *b_obj;
public:
void set(int);
};
a::a()
{
b_obj = new b;
}
a::set(int s)
{
b_obj->c = s;
}
class b
{
public:
int c;
};
is this code valid? if no, how do i make b_obj of a particular object (say a_obj) of class a ,modifiable in another class c...if a_obj i created in another class d....i am scared of a_obj going out of scope in class c.
hope you understand my question. thanks a lot for taking the time to read my post