When should one use inheritance ? Give example.
Answers
Answered by
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
Math,
7 months ago
Math,
7 months ago
Computer Science,
1 year ago
Social Sciences,
1 year ago
English,
1 year ago
Computer Science,
1 year ago