Inheriting Interfaces

Interfaces are considered invariant. This simply means that after you publish an interface you are not supposed to change it. Suppose we had published the IDrawable interface from the last section and then decided that we wanted to change the interface. The solution to this problem is to use interface inheritance.

To indicate that a new interface is derived from an existing interface, we must use the Inherits statement (similar to deriving a new class). Continuing our example, then, we could define a new interface, IDrawable2, and indicate that it is derived from IDrawable. The code for the new interface would begin as shown below.

Public Interface IDrawable2
  Inherits IDrawable
End Interface

So far IDrawable2 has the same ...

Get Visual Basic® .NET Power Coding now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.