Since I'm a newbie in C++, here it goes!
I have a base class (I'm not using inheritance anywhere) with two objects from two other classes. I need to have access from a private member to the other in another class.
class base
{
private:
myClass1 m1;
myClass2 m2;
public:
base() {};
~base() {};
};
class myClass1
{
private:
int m_member1;
public:
myClass1() {};
~myClass1() {};
};
class myClass2
{
private:
int m_member2;
public:
myClass2() {};
~myClass2() {};
int sum_members_because_yes(void)
{
return (myClass1::m_member1 + m_member2); //HOW CAN I DO THIS???
}
};
How can I have access of m_member1 from myClass1 in myClass2? :)
(I want to avoid inheritance, because on my code the myClass1 and 2 is not a base class...)
Thanks