Thursday, July 1, 2010

OOPS Concept - Rules of Inheritance

1. Base class of non-abstract, virtual type.
a. Sub class inherited the base class.
b. Subclass overrides the base class function.
c. Subclass hides the base class function by new keyword.
d. Can’t override or hide a method which is not declared as virtual.

2. Base Class abstract type
a. Can declare abstract methods, which can’t have any body.
b. Can declare virtual methods which can have body.
c. Can contain non-abstract / virtual methods – simple methods are allowed.
d. All method declared as abstract must be inherited to the base class.