declared with the MustInherit keyword. This specifies that

declared with the MustInherit keyword. This specifies that we cannot create objects of type CEmployee. In each of the previous cases, the IncSalary member of the base class CEmployee is an abstract member. Any class that contains at least one abstract member is termed an abstract class. (Thus, the CEmployee class as defined earlier is an abstract class.) This terminology comes from the fact that it is not possible to create an object from an abstract class because at least one of the object’s methods would not have an implementation. There are also situations where we might want to define a class in which all members are abstract. In other words, this is a class that only defines an interface. We might refer to such a class as a pure abstract class, although this terminology is not standard. For example, imagine a Shape class called CShape that is designed to model the general properties and actions of geometric shapes (ellipses, rectangles, trapezoids, etc.). All shapes need a Draw method, but the implementation of the method varies depending on the type of shape circles are drawn quite differently than rectangles, for example. Similarly, we want to include methods called Rotate, Translate, and Reflect, but, as with the Draw method, each of these methods require a different implementation based on the type of shape. Thus, we can define the CShape class in either of the following ways: Public Class Class2 Public Overridable Sub Draw( ) End Sub Public Overridable Sub Rotate(ByVal sngDegrees As Single) End Sub Public Overridable Sub Translate(ByVal x As Integer, _ ByVal y As Integer) End Sub Public Overridable Sub Reflect(ByVal iSlope As Integer, _ ByVal iIntercept As Integer) End Sub End Class or: Public MustInherit Class CShape Public MustOverride Sub Draw( ) Public MustOverride Sub Rotate(ByVal sngDegrees As Single) Public MustOverride Sub Translate(ByVal x As Integer, _ ByVal y As Integer) Public MustOverride Sub Reflect(ByVal iSlope As Integer, _ ByVal iIntercept As Integer) End Class Now we can define derived classes such as CRectangle, CEllipse, CPolygon, and so on. Each of these derived classes will (or must, in the latter case) implement the members of the base class CShape. (We won’t go into the details of such an implementation here, since it is not relevant to our discussion.)
Note: If you are looking for cheap and quality provider to host and run your java application check Astra java hosting services

Comments are closed.