+ 5
What is class and inheritance ?
what is the use of this. plz like and coment here
2 Antworten
+ 7
In object-oriented programming, inheritance enables new objects to take on the properties of existing objects. A class that is used as the basis for inheritance is called a superclass or base class. A class that inherits from a superclass is called a subclass or derived class.
Inheritance is a good choice when:
Your inheritance hierarchy represents an "is-a" relationship and not a "has-a" relationship.
You can reuse code from the base classes.
You need to apply the same class and methods to different data types.
The class hierarchy is reasonably shallow, and other developers are not likely to add many more levels.
You want to make global changes to derived classes by changing a base class.
+ 2
Classes are made to organize similar functions under one umbrella. Inheritance is made to organize hierarchy among classes