When there are several classes that have many common data attributes, it is better to write a superclass to hold all the general data.
What is a superclass?
- The variables and methods of a class can be used again in another class through inheritance in any object-oriented programming language.
- The term "superclass" or "parent class" refers to the class from which another class inherits its properties, and the term "subclass" refers to the class from which another class inherits its properties.
- The data and behavior of the parent class are inherited by the subclass. But we can also modify the subclass's behavior and add extra data and activity to it.
An OOP language's inheritance feature allows the information and behavior of a superclass to be transferred to a subclass. Following subclasses are the leaves that are descended from their parent class, forming the root of a tree hierarchy.
Know more about superclass with the help of the given link:
https://brainly.com/question/13120534
#SPJ4