C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » .NET Framework »

What is inheritance?


Posted Date: 14 Jul 2006    Resource Type: Articles    Category: .NET Framework
Author: Roger StuartMember Level: Silver    
Rating: 1 out of 5Points: 10



Inheritance is a process by which one class acquires the members of an existing class. It describes a hierarchical relationship between classes. For example, a lion is a kind of animal. Now talking in terms of object-oriented programming, it can be said that Lion is a subclass of Animal, and Animal is a super class of Lion.


By use of inheritance, a class inherits the general attributes and behaviors from its super class, and defines only those members that make it unique. Inheritance exposes, extends, or alters the attributes and behaviors of the super class. A subclass can extend but cannot narrow its super class.


Following are the different forms of inheritance:

  1. Single inheritance
  2. Multilevel inheritance
  3. Hierarchical inheritance
  4. Multiple inheritance
In single inheritance, a class inherits implementation from only one super class. For example, if class B inherits from class A, class B will acquire all the members declared in class A.




In multilevel inheritance, a class inherits from a derived class (or subclass). For example, if class C inherits from class B, and class B inherits from class A, class C will acquire all the members declared in class B as well as all the members declared in class A.




In hierarchical inheritance, many sub classes inherit from a single super class. For example, if classes B, C, and D inherit from class A, classes B, C, and D will acquire all the members declared in class A.




In multiple inheritance, a class inherits from several super classes. For example, if class C inherits from both class A and class B, class C will acquire all the members declared in class A as well as all the members declared in class B. Multiple inheritance is not directly implemented by classes in Visual Studio .NET. However, this concept can be implemented using interfaces.




Reference: Visual Studio .NET Combined Collection, Contents: "Inheritance", "Inheritance Basics"


About the Author:



uCertify was formed in 1996 with an aim to offer high quality educational training software and services in the field of information technology to its customers. uCertify provides exam preparation solutions for the certification exams of Microsoft, CIW, CompTIA, Oracle, Sun and other leading IT vendors. To know more about uCertify, please visit http://www.ucertify.com/





Responses

Author: critic    16 Jul 2006Member Level: Bronze   Points : 0
http://www.ucertify.com/article/MCAD/what-is-inheritance.html


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Accessing the Values from Registry
Previous Resource: OOPS concept in VB.NET and C#.NET
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use