In `true' multiple inheritance, a subclass may inherit from two base classes that have a method with the same name. For example, suppose we have a class called `A' and a class called `B', and both have a method called `test()'. Class `C' is a subclass of both A and B, and it does not have its own `test()' method. So if we call the method C.test(), does it call A.test() or B.test()? This confusion is one of the arguments used by the Java developers for disallowing multiple inheritance in Java. Suppose we have an interface (not a class) called A and a class called B, and both have a method `test()'. What happens if class C extends B and implements A, and we call C.test()? How does this avoid the problem? Discussion of Review Question 1 Back to top 
RITSEC - Global Campus Copyright ?1999 RITSEC- Middlesex University. All rights reserved. webmaster@globalcampus.com.eg |