0% found this document useful (0 votes)
48 views6 pages

What Is Inheritance?

The document discusses the concept of inheritance in object-oriented programming, explaining that inheritance allows new classes to reuse and modify behaviors defined in other base classes, providing benefits like code reusability and a clear hierarchical structure. Examples of implementation inheritance and interface inheritance in C# are provided to illustrate how inheritance works and how behaviors and properties are inherited through the inheritance tree structure.

Uploaded by

Suhin Vimal Raj
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views6 pages

What Is Inheritance?

The document discusses the concept of inheritance in object-oriented programming, explaining that inheritance allows new classes to reuse and modify behaviors defined in other base classes, providing benefits like code reusability and a clear hierarchical structure. Examples of implementation inheritance and interface inheritance in C# are provided to illustrate how inheritance works and how behaviors and properties are inherited through the inheritance tree structure.

Uploaded by

Suhin Vimal Raj
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

/w EPDw UKMTgy

Home | Tutorial | Articles | Forum | Interview Question | Code Snippets | News | Fun Zone | Poll | Web Links | Certification | Search Welcome :Guest Home >> Articles >> OOPS >> Post New Resource Subscribe to Articles

Sign In Register Win Surprise Gifts!!! Congratulations!!!

What is Inheritance?
Posted By :Gurunath Dogi Posted Date :14/08/2009 Points :25 Category: OOPS URL: http://www.dotnetspark.com

Introduction
This article will explain you about inheritance by using a suitable example for the fresher's and for the working guy's to clear the OOP's concept. Watch our 500 videos on Azure, WCF, WPF, LINQ, Design Patterns, WWF, Silverlight, UML @ http://www.questpond.com/

What is Inheritance?
Inheritance, together with encapsulation and polymorphism, is one of the three primary characteristics (concept) of objectoriented programming Inheritance enables you to create new classes that reuse, extend, and modify the behavior that is defined in other classes The Class whose methods and variables are defined is called super class or base class The Class that inherits methods and variables are defined is called sub class or derived class Sometimes base class known as generalized class and derived class known as specialized class Keyword to declare inheritance is ":" (colon) in visual C#.

Benefits of using Inheritance

Once a behavior (method) or property is defined in a super class(base class),that behavior or property is automatically inherited by all subclasses (derived class). Code reusability increased through inheritance Inheritance provide a clear model structure which is easy to understand without much complexity Using inheritance, classes become grouped together in a hierarchical tree structure Code are easy to manage and divided into parent and child classes

Example of Inheritance

Top 5 Contributors of the Month Karthik Ghanashyam Nayak Dhiraj Ranka Manas Patnaik Dhananjay Kumar

Types of Inheritance in C#:

Implementation Inheritance Multiple Inheritances (Interface Inheritance)

Implementation Inheritance
One base class (super class) and one derived class (sub class).

Example:

Interface Inheritance
An interface looks like a class, but has no implementation. It contains definitions of events, indexers, methods and properties. An interface inherited by classes An interface inheritance defined with keyword "interface". In C# Interface Inheritance also known as multiple inheritances.

Inheritance Tree Structure:

Code Example
"Implementation inheritance code example" and "Interface inheritance code example" attached at the bottom of this article. Download gurumatrix_633858097994584667_Code.zip

Featured Articles
Best Practices No 5: - Detecting .NET application memory leaks

Memory leaks in .NET application have always being programmer's nightmare. Memory leaks are biggest problems when it comes to production servers. Productions servers normally need to run with least down time. Memory leaks grow slowly and after sometime they bring down the server by consuming huge chunks of memory. Maximum time people reboot the system, make it work temporarily and send a sorry note to the customer for the downtime. ... Read More .NET Best Practice No: 1:- Detecting High Memory consuming functions in .NET code One of the important factors for performance degradation in .NET code is memory consumption. Many developers just concentrate on execution time to determine performance bottle necks in a .NET application. Only measuring execution time does not clearly give idea of where the performance issue resides. Ok, said and done one of the biggest task is to understand which function, assembly or class has consumed how much memory. In this tutorial we will see how we can find which functions consume how much memory. This article discusses the best practices involved using CLR profiler for studying memory allocation.... Read More How to improve your LINQ query performance by 5 X times ? LINQ has been criticized by many early adopters for its performance issues. Well if you are just going to drag and drop using DBML code generator I am sure you will land up in to mess. Try doing this make a simple LINQ to SQL project using DBML and see your SQL profiler, I am sure you will never like to touch DBML code generator again. ... Read More Responses Author: Venkat Company URL: http://www.dotnetspark.com Posted Date: 27/08/2009 Excellent...very nice explanation on oops concept in .net... Thanks, venkat

Post Comment
You must Sign In To post reply

Read also another Resources from the same

Related Resource From The Same

Author

Category

What is an Abstraction? Access Modifiers in C# What is Encapsulation? What is Polymorphism? What is an Object?

What is an Abstraction? What is Encapsulation? What is Polymorphism? What is an Object?

Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame Twitter Terms of Service Privacy Policy Contact Us Friend

Archives Tell A

You might also like