73.7k views
1 vote
If there are three classes, Shape, Circle and Square, what is the most likely relationship among them?

a. Square is a base class, and shape and circle are derived classes of Square.
b. Shape is a base class, and circle and square are derived classes of Shape.
c. Shape, circle and square are all sibling classes.
d. These three classes cannot be related.

User Gillytech
by
6.0k points

1 Answer

6 votes

Answer: B) Shape is a base class, and circle and square are derived classes of Shape.

Explanation:

Shape is a base class because circle and squares are the shapes so these are the derived class of the shape, which is inherited by the shape like circle and square. As, the base class (shape) is the class which are derived from the other classes like circle and square and it facilitates other class which can simplified the code re-usability that is inherited from the base class. Base class is also known as parent class and the super class.

User Leo Lukin
by
6.4k points