Monday, June 28, 2010

Inheritance in .Net

Inheritance is the concept of reusability. Using inheritance one class feature we can access in the other classes.
##5 Types of Inheritance

! Single Inheritance - One base class --> One child class directly

! Multilevel Inheritance - Base class --> Child class (d1) --> Child class(d2)

! Hierarchical Inheritance - Base class ---- Child class (c1)
Child class (c2)

! Multiple Inheritance - Base class(b1)
--- Child class
Base class (b2)


! Hybrid Inheritance - Altogether, C# doesn't support Hybrid inheritance always child classes having multiple duplicate copies getting ambiguos error.
To overcome this error we have to work with virtual base classes. Virtual base classes derive only one copy to the child classes.

0 comments:

Post a Comment