declared with the MustInherit keyword. This specifies that
3.5.1 Interfaces Revisited We have seen that interfaces can be defined in class modules. VB .NET also supports an additional method of defining an interface, using the Interface keyword. The following example defines the IShape interface: Public Interface IShape Sub Draw( ) Sub Rotate(ByVal sngDegrees As Single) Sub Translate(ByVal x As Integer, ByVal y As Integer) Sub Reflect(ByVal iSlope As Integer, _ ByVal iIntercept As Integer) End Interface Note that we cannot implement any of the members of an interface defined using the Interface keyword, that is, not within the module in which the interface is defined. However, we can implement the interface using an ordinary class module. Note the use of the Implements statement (which was also available in VB 6, but could be applied only to external interfaces): Public Class CRectangle ‘ Implement the interface IShape Implements IShape Public Overridable Sub Draw( ) Implements IShape.Draw ‘ code to implement Draw for rectangles End Sub Public Overridable Sub Spin( ) Implements IShape.Rotate ‘ code to implement Rotate for rectangles End Sub End Class Note also the use of the Implements keyword in each function that implements an interface member. This keyword allows us to give the implementing function any name it does not need to match the name of the method (see the Spin method earlier in this section, which implements the IShape interface’s Rotate method). However, it is probably less confusing (and better programming practice) to use the same name. The main advantage of using the Implements keyword approach to defining an interface is that a single class can implement multiple interfaces, whereas VB .NET does not permit a single class to inherit directly from multiple base classes. On the other hand, the main disadvantage of the Interface keyword approach is that no implementation is possible in the module that defines the interface. Thus, all interface members must be implemented in every class that implements the interface. This can mean code repetition if an interface member has the same implementation in more than one implementing class. 3.6 Polymorphism and Overloading Fortunately, we don’t need to go into the details of polymorphism and overloading, which is just as well, because they tend to be both confusing and ambiguous. For instance, some computer scientists say that overloading is a form of polymorphism, whereas others say it is not. We will discuss only those issues that are directly relevant to the .NET Framework. 3.6.1 Overloading
Note: If you are looking for cheap and quality provider to host and run your java application check Astra java hosting services