What do you mean by inheritance?

by jack| Views: 1241

What do you mean by inheritance?



Tags:  Oops Interview

Answers (3)
 
kethlin Said..

Inheritance is the ability to define a new class that inherits the behaviors (and code) of an existing class. The new class is called a child or derived class, while the original class is often referred to as the parent or base class.

Inheritance is used to express “is-a” or “kind-of” relationships. For example A car, a boat & a submarine is a vehicle. In OOP, the Vehicle base class would provide the common behaviors of all types of vehicles and perhaps delineate behaviors all vehicles must support. The particular subclasses (i.e., derived classes) of vehicles would implement behaviors specific to that type of vehicle. The main concepts behind inheritance are extensibility and code reuse.

C++ supports multiple inheritance. In this scenario, one class inherits from more than one base class. But using multiple inheritance can be tricky. Base classes with identical function names or common base classes can create nightmares for even the most experienced programmers.

VB.NET, like Java avoids this problem altogether by providing support only for single inheritance. But don’t worry, you aren’t missing out on anything. Situations that seem ideal for multiple inheritance can usually be solved with composition or by rethinking the design.



kamlesh Pandey Said..

To inherit the property of one class things into another class is known as inheritance



Ravi Prakash Pandey Said..

Inheritance is the process by which object of one class aquire the property of another class, it provide the idea of reusualibity, its means that we can use an existing to onother class without modyfying it.
Inheritance is very important in OOPS



Register or Login to Post Your Opinion/Answer