Explain single Inheritance with example.
Answers
Answered by
1
Hyy dear
Single inheritance enables a derived class to inherit properties and behavior from a single parent class. ... Inheritance is one of the key features of object-oriented programming (OOP). Single inheritance is safer than multipleinheritance if it is approached in the right way.
For example, a child inherits the traits of his/her parents. With inheritance, we can reuse the fields and methods of the existing class.
Single inheritance enables a derived class to inherit properties and behavior from a single parent class. ... Inheritance is one of the key features of object-oriented programming (OOP). Single inheritance is safer than multipleinheritance if it is approached in the right way.
For example, a child inherits the traits of his/her parents. With inheritance, we can reuse the fields and methods of the existing class.
Answered by
0
Single Inheritance:
- Single inheritance is a method in which there is only one subclass or child class and one parent class or superclass. Single inheritance is the most simple and easy method of inheritance in which only a single subclass can inherit any method or function of the parent class.
- Inheritance is the most important feature of the OOP i.e. object-oriented programming language in which we can reuse the already defined functions in a class. We can save the time and line of code in this way.
- Examples of simple inheritance can be truck can be derived from vehicle class since the car is a type of vehicle.
Similar questions
Science,
7 months ago
Computer Science,
7 months ago
Chemistry,
1 year ago
Chemistry,
1 year ago
Math,
1 year ago