• Many C++ derivative languages do away with multiple inheritance
given issues like property & method name clashes
• However, if you define abstract classes as interfaces (all pure virtual
methods), then multiple inheritance can be quite useful
class MyCarInterface {
public:
virtual void setAccelerator(double accelerationVal) = 0;
virtual double getAccelerator() = 0;
virtual bool turnRight() = 0;
virtual bool turnLeft() = 0;
virtual void brake() = 0;
};
class ToyotaPrius : public Toyota, MyCarInterface {
public:
ToyotaPrius() : Toyota() {}
.... some Toyota methods here .....
public:
// the MyCarInterface methods implemented here
void setAccelerator(double accelerationVal);
double getAccelerator();
bool turnRight();
bool turnLeft();
void brake();
};