如果一个类与另一个类具有“has-a”关系,并且它派生出同一个类,会发生什么?
class A
{
friend classB;
// here lots of things might be , but i just try to understand how should I think.
};
class B : public A
{
// here again might be couple lines of codes.
protected:
A d;
};
这里到底发生了什么?我应该怎么想?