Inheritance is the process by which object of one class acquire the properties of objects of another class.  Inheritance supports the concept of hierarchical classification.  For example, the bird robin is a part of the class flying bird, which is again a part of the class bird.  As Illustrated in Fig2.1 the principle behind this sort of division is that each derived class shares common characteristics with the class from
which it is derived. 

In OOP, the concept of inheritance provides the idea of re-usability. This means that we can add additional features to an existing class without modifying it.  This is possible by deriving a new class from the existing one.  The new class will have the combined features of both the classes.  Thus the real appeal and power of the inheritance mechanism is that it allows the programmer to reuse a class that is almost, but not exactly, what he wants, and to tailor the class in such a way that it does not introduce any undesirable side effects into the rest of the classes.  In Java, the derived class is known as subclass. 

Example: 

class building
{
 int rooms;
 int floors;
 int areas;
 public:
  void set_rooms(int num);
  int get_rooms();
  void set_floors(int num);
  int get_floors();
  void set_area(int num);
  int get_area();
};
class house:public building   // class house is the inherited class of building
{
 int bedrooms;
 int baths;
 public:
  void set_bedrooms(int num);
  int get_bedrooms();
  void set_baths(int num);
  int get_baths();
};
void building::set_rooms(int num) //function definition part
{
 rooms = num;
}
int building:: get_rooms()
{
 return rooms;
void building::set_floors(int num)
{
 floors = num;
}
int building::get_floor()
{
 return floors;
}
void building::set_area(int num) 
{
 area = num; 
}
int building::get_area()
{
 return area;
}
void house::set_bedrooms(int num)
{
 bedrooms = num;
}
int house::get_bedrooms()
{
 return bedrooms;
}
void house::set_baths(int num)
 baths = num; 
}
int house::get_baths()
{
 return baths;
}
void main()
{
 house h1;
h1.set_rooms(10);
 h1.set_floors(5);
 h1.set_bedrooms(10);
 h1.set_baths(5);
 h1.set_area(950);
  cout<<"number of rooms"<<h1.get_rooms();
  cout<<"number of floors"<<h1.get_floors();
  cout<<"number of bedrooms"<<h1.get_bedrooms(); 
  cout<<"number of baths"<<h1.get_baths();
  cout<<"area of a house"<<h1.get_area();
 return 0;
}
The above example clearly states the concept of inheritance.  Since class house is the inherited class of building it can able to access the building class members(base class) and its member functions.