Total members 11889 |It is currently Thu Mar 28, 2024 10:23 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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



_________________
Please recommend my post if you found it helpful


Author:
Beginner
User avatar Posts: 109
Have thanks: 5 time
Post new topic Reply to topic  [ 1 post ] 

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



Topic Tags

Java OOP
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com