I assume you mean, you are writing a set of classes that all have the
same properties (at least to start with).
There are two ways of doing this - Inheritance or Interfaces.
Using Inheritance:
Class Person
Public Property Name() As String
End Property
End Class
Class Employee
Inherits Person
End Class
Note that Employee class does not declare a Name property - but
this still works ...
Private oMe as New Employee
MsgBox( oMe.Name )
This is because the Name property is inherited from the Person class.
Using Interfaces:
Interface NameableThing
Property Name() as String
End Interface
Class Employee2
Implements NameableThing
Private Property EmployeeName() as String _
Implements NameableThing.Name
End Property
End Class
Dim oMe As NameableThing _
= New Employee2
MsgBox( Oops.Name )
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.