Single Inheritance Versus Multiple Inheritance

I l @ ve RuBoard

With single inheritance, a class has one set of parents ”that is, there is one chain of superclasses (e.g., a car is a motor vehicle, which is a vehicle). Multiple inheritance involves more than one chain of superclasses (e.g., an amphibious vehicle is a motor vehicle, which is a vehicle, and an amphibious vehicle is a water vehicle, which is a vehicle). There can be numerous problems associated with multiple inheritance ”for example, name clashes and multiple copies of inherited features. How the problems are overcome is very language dependent from the use of special features of C++ (e.g., virtual base classes) to lack of support for multiple inheritance altogether (PowerBuilder). Multiple inheritance also leads to less maintainable code ”the more superclasses, the harder it is to determine what comes from where and what happens if I change something. The bottom line: Use multiple inheritance only when it is needed and always use it with care!

I l @ ve RuBoard


Visual Modeling with Rational Rose 2002 and UML
Visual Modeling with Rational Rose 2002 and UML (3rd Edition)
ISBN: 0201729326
EAN: 2147483647
Year: 2002
Pages: 134

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net