| Author: shivi purwar 26 Aug 2006 | Member Level: Bronze | Rating: Points: 2 |
Abstract (MustInherit) Classes Abstract classes can simply defined as incomplete classes.
Abstract (MustInherit) classes contain one or more incomplete methods called abstract (MustOverride) methods. The abstract (MustInherit) class only provides the signature or declaration of the abstract (MustOverride) methods and leaves the implementation of these methods to the derived or sub-classes. 1.Abstract classes are marked with MustInherit and abstract methods are marked with the MustOverride keyword 2.Since abstract classes are incomplete; they can not be instantiated. They must be sub-classed in order to use their functionality. This is the reason why an abstract class can't be NotInheritable 3.A class inheriting an abstract class must implement all the abstract methods in the abstract class or it must also be declared as an MustInherit class. 4.A class inheriting an abstract class and one that implements all its abstract methods is called a concrete class of that abstract class. 5.We can declare a reference of the type of abstract class and it can point to the objects of classes that have inherited the abstract class. MustInherit Class TaxCalculator Protected mItemPrice As Double Protected mTax As Double
' an abstract (MustOverride) function Public MustOverride Function CalculateTax() As Double
' Two concrete properties Public ReadOnly Property Tax() As Double Get Return Tax End Get End Property
Public ReadOnly Property ItemPrice() As Double Get Return ItemPrice End Get End Property End Class
|
| Author: DotNetGuts (DNG) 26 Aug 2006 | Member Level: Diamond | Rating: Points: 2 |
All abstract method needs to override in subclass and so u hv to write
|