Explore BrainMass

Several questions about class inheritance

Classes A, B, C and H are related through inheritance and have the fields shown in the class tree
diagram below. Class G is not related to any of the other classes

Please see attachment file for more details


Solution Preview

The first question asks about the derivations of classes. The arrows
in the diagram indicate "derives from". That is, if class B has an
arrow to class A that means that class B derives from class A. With
that in mind we can answer each of the given questions:

i) A is a derived class of B and B is a derived class of C.

This is false. The arrows go from C to B and B to A, not the other
way around.

ii) C is a derived class of B and B is a derived class of A.

This is tue. The arrows are heading in the correct direction.

iii) A and B are both derived classes of C.

False. Instead C derives from B (and A).

iv) B and C are both derived from A.

True. B derives ...

Solution Summary

This solution provides detailed answers to explain several questions about class inheritance in an object oriented design.