Search This Blog

Wednesday, 13 April 2011

Inheritance

This is one of the important Oops. concept.
what is inheritance:
Aquiring the properties of one object class to another object class is called inheritance.
Means suppose take an example of  mother and child,some of the mother features will come to child.
Like this only in java suppose take class A it contains a variable test as int data type.
and a method function as display with return type void.
now take another class B it extends Class A means A is super class and now B is subclass
now B class will contain variable test and function display.
syntax of this is as follows......
Class A
{
//variables and functions
}

Class B extends A
{
//you can add your own functions also here
}
I will post the types of inheritance in my next post...

No comments:

Post a Comment