OOP Inheritance Concept

                    Important Aspects of OOP


Inheritance:

                      In real-life, inheritance
                      means adopting characters and traits of your ancestors especially parents.

Inheritance In Java Language

“The process by which one class acquires the properties(data members) and functionalities(methods) of another class is called inheritance.”It is one of the key features of OOP that allows us to create a new classfrom an existing class. 

 • Advantages

❖Reusability of code
❖Common functionalities can be extended from another class.
--------------------------------------------------------------------------------------------------------------------------------
•Parent Class:
The class whose properties and functionalities are used(inherited) by another
class is known as Parent class or Super class or Base class. 

• Child Class:
The class that extends/ uses the features of another class is known as Child
class or Sub class or derived class.

• The concept of inheritance is also known as sub classing or
   derivation.
• The biggest advantage of Inheritance is that the code that is
   already present in base class need not be re-written in the child
   class.

Syntax of Inheritance:

  class Subclass-Name extends Superclass-Name 
{
      // old methods and fields are inherited
       //new methods and fields can be created
}

• The extends keyword indicates that you are making a new class that is
derived from an existing class.












Comments