![]() ![]() Interfaces cannot contain any implementation code or statements associated with implementation code, such as End Sub or End Property. ![]() The remaining statements in the interface definition should be Event, Sub, Function, Property, Interface, Class, Structure, and Enum statements. The Inherits statements must precede all other statements in the declaration except comments. Following the Interface statement, you can add an optional Inherits statement that lists one or more inherited interfaces. Interface definitions are enclosed within the Interface and End Interface statements. For example, structures cannot inherit from classes, but they can implement interfaces. Interfaces are useful when you cannot use class inheritance. Interfaces are better in situations in which you do not have to inherit implementation from a base class. Interfaces are more flexible than base classes because you can define a single implementation that can implement multiple interfaces. Interfaces are better suited to situations in which your applications require many possibly unrelated object types to provide certain functionality. There are several other reasons why you might want to use interfaces instead of class inheritance: You can add new features at any time by developing additional interfaces and implementations. Interfaces allow you to define features as small groups of closely related properties, methods, and events this reduces compatibility problems because you can develop enhanced implementations for your interfaces without jeopardizing existing code. ![]() Interfaces define the properties, methods, and events that classes can implement. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |