Total members 11894 |It is currently Wed Nov 27, 2024 6:41 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?!!
 Need Help about Inheritance     -  
 help me! inheritance     -  
 Inheritance in c++     -  
 Inheritance C++ Example     -  
 inheritance in c++     -  
 Inheritance in java     -  
 @AttributeOverride with Inheritance     -  
 Multiple Inheritance     -  
 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