INHERITANCE

The inherits statement is used to declare a new class,called a derived class,based on an existing class,

known as a base class. derived classes inherit,and can extend,the properties,methods,events,fields,and

constants defined in the base class.

Rules for inheritance:


-> All classes are inheritable by default unless marked with the NOTINHERITABLE keyword.classes can inherit from other

classes in your project or from classes in other assemblies that your project references.


->Unlike languages that permit multiple inheritance,visual basic permits only single inheritance in classes;that is,derived classes

can have only one base class.Although multiple inheritance is not allowed in classes,classes can implement multiple interfaces,

which can effectively accomplish the same ends.
-->To prevent exposing restricted items in a base class,the access type of a derived class must be equal to or more restrictive than

its base class.for example,a Public class cannot inherit a freind or a private class,and a friend class cannot inherit a private class.

Inheritance Modifiers

-->INHERITS statement -specifies the base class.

-->NOTINHERITABLE modifier-prevents programmers from using the class as a base class.

-->MUSTINHERIT modifier-specifies that the class is intended for use as a base class only.instances of

MUSTINHERIT classes cannot be created directly;they can only be created as base class instance of a

derived class.


Average Rating (0)
by Ravina   gamit  in VB.Net  on 3/24/2015 10:34:36 PM  


Post Your Comment
*