"ABC" <abc.abc.com> wrote in message
news:O7*************@TK2MSFTNGP11.phx.gbl...
I am always to write clases which has properties
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 )
HTH,
Phill W.