Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

What is Inheritance?!!

Wed Jul 04, 2007 12:01 am

What is Inheritance?
---------------------------------


A class inherits state and behavior from its super class. Inheritance provides a powerful and natural mechanism for organizing and structuring software programs. Benefit of inheritance is that subclasses provide specialized behaviors from the basis of common elements provided by the super class. Through the use of inheritance, programmers can reuse the code in the super class many times.

Inheritance extends the concept of Classes and Objects more to facilitate representation of types based on their similarities. Java uses the keywords extends and implements for applying inheritance. In the example the Class Tool is super class to class ScrewDriver and Saws. The inheriting classes acquire the properties of the super class.

java code
Class Tool{
String color;
float price;
}
Class ScrewDriver extends Tool {
String handleType;
String tipType;
}
Class Saws extends Tool {
String bladeSize;
}


Read more More Inheritance Examples



Post a reply
  Related Posts  to : What is Inheritance?!!
 help me! inheritance     -  
 Inheritance in c++     -  
 Inheritance C++ Example     -  
 inheritance in c++     -  
 Need Help about Inheritance     -  
 Inheritance in java     -  
 @AttributeOverride with Inheritance     -  
 Multiple Inheritance     -  
 single table inheritance     -  
 Inheritance & polymorphism checker code     -  

Topic Tags

Java OOP