InheritanceQuiz.md - brainchildservices/curriculum GitHub Wiki
What is Inheritance?
Inheritance is one of the major pillars of object-oriented programming.Inheritance is a mechanism by which a new class is derived from an existing
one.
Define base class.
A base class is a class in Object-Oriented Programming language, from which other classes are derived. The class which inherits the base class has
all members of a base class as well as can also have some additional properties.
Define derived class.
A class that is created from an existing class. The derived class inherits all members and member functions of a base class. The derived class can
have more functionality with respect to the Base class and can easily access the Base class.
What are the types of inheritance?
Single Inheritance
Hierarchical Inheritance
Multilevel Inheritance
Multiple Inheritance
Define single inheritance.
In single inheritance, subclasses inherit the features of one superclass.
Define Hierarchical Inheritance.
In this type of inheritance, the multiple classes derives from one base class. It's like having multiple kids, all inheriting traits from parent,
but in their own different ways.
Define Multilevel Inheritance.
In Multilevel Inheritance, a derived class will be inheriting a base class and as well as the derived class also act as the base class to other
class.
What is the use of Inheritance?
It helps in using the same code again means code reusability.
It reduces code redundancy.
It helps in reading the code more comfortably.
It also reduces the size of the source code and file.
It helps in providing the extensibility to code.
The code is easy to manage as it divided into classes of the base class and child class.
It helps in dividing the large code into small pieces.
What is a sealed class?
Sealed class is used to stop a class to be inherited. You cannot derive or extend any class from it.
Does C# support multiple inheritance?
C# does not support multiple inheritance , because they reasoned that adding multiple inheritance added too much complexity to C# while providing
too little benefit