Q:

Inherit same class twice in C++ (on purpose)

I have a Circle class and a Rectangle class.
I now want to make a class FunnyObject, each made of one circle and two rectangles.
If I do this:
class FunnyObject:public Circle, public Rectangle, public Rectangle{
//How do I refer to each of the Rectangle classes?

}

How do I refer to the functions and variables in both the Rectangle classes, since there is ambiguity?
Also, generally the constructor is:
FunnyObject::FunnyObject:Circle(arguments), Rectangle(arguments){
//....
}

How will the constructor look in my case?

A:

I have a Circle class and a Rectangle class. I now want to make a class FunnyObject, each made of one circle and two rectangles.

Use object composition rather than inheritance.
class FunnyObject
{
    Circle circle;
    Rectangle rectangle1;
    Rectangle rectangle2;
}

A:

An easy trick to help with inheritance is to think about "is a" vs. "has a".
If you have an "is a" relationship, you use inheritance. If you have a "has a" relationship, you make a new data member.
Is FunnyObject a Rectangle and a Circle? If so, inherit.
Does FunnyObject have two Rectangles and Circle? If so, make member variables.

A:

You don't need inheritance in this case, use composition:
class FunnyObject
{
    Circle myCircle;
    Rectangle myRectangle1;
    Rectangle myRectangle2;
}

