26 August 2012

Inheritance in C#.Net:

In this Article , i am trying to exaplin Inheritance in C#.Net.
Inheritance :
  Create a New Class and Called into Existing Class.
All form have a Control.in my Example . Form is a parent class and Control is a Existing Class.
what is symbol for inheritance?
Just colon (:) using between the classes.
For eg:
class txtControl : Form
{
// Code Here
}
Here , txtControl is a Child Class and Form is Parent class .we just inherit from new class into Existing class.
Main Advantages of Inheritance:
                Reusability code.
Difference Types of Inheritance:
1)Single Inheritance2)Hierarchical Inheritance3)Multi Level Inheritance4)Hybrid Inheritance5)Multiple Inheritance.
1)Single Inheritance:
    Single Drived class is created from a Single Base Class.
2)Hierarchical Inheritance:
             More than one derived class are created from a single base class, then that inheritance is called as hierarchical inheritance.
3)Multi Level Inheritance:
     A derived class is created from another derived class, then that inheritance is called as multi level inheritance.
4)Hybrid Inheritance:
    Any combination of single, hierarchical and multi level inheritances is called as hybrid inheritance
5)Multiple Inheritance:
     derived class is created from more than one base class then that inheritance is called as multiple inheritance.
Nice Article for Oops:
http://www.programcall.com/9/csnet

No comments: