Interfaces tend to be polymorphic, i.e. similar in behavior and format even between different classes of a component. EG:A Plant component with a Tree class may have two classes called Oak and Pine where each has similar methods such as Grow().

In VB, an abstract class can have both blank (unimplemented) members and implemented members.

Here is a sample abstract class called Tree.

Option Explicit
'Notice that the procedure is empty.
Public Function Grow(ByVal Meters As Single)
End Function
Public Property Get Age() As Long
End Property

Here is a sample child class called Oak (a similar one could be made for Pine).

Option Explicit
Implements Tree
Private dblPlanted As Double
Private Function Tree_Grow(ByVal Meters As Single) As Single
    Tree_Grow = Meters * 0.1
End Function
Private Property Get Tree_Age() As Double
    Tree_Age = Now - dblPlanted
End Property
Private Property Let Tree_Age(ByVal RHS As Long)
    lngAge = RHS
End Property

Here is a sample of form code in the same project.

Dim oak1 As Oak
Dim tree1 As Tree
Set tree1 = New Tree
'tree1 points to a Tree object
Set oak1 = New Oak
Set tree1 = oak1
'tree1 points to a Oak object

Page Modified: (Hand noted: ) (Auto noted: )