Computer Science, asked by TbiaSamishta, 11 months ago

When should one use inheritance ? Give example.

Answers

Answered by aqibkincsem
0

"Inheritance enables new objects in object oriented programs or OOP and this process can take the existing objects too.


Superclass or base class is the basis for ingeritance of OOP and A class that inherits from a superclass is called a subclass or derived class.


Example: To inherit a class we use extends keyword.


Here class XYZ is child class and class ABC is parent class. The class XYZ is inheriting the properties and methods of ABC class.


class XYZ extends ABC

{

}

"

Similar questions