Is here any fast method let me type properties more fast?

  • Thread starter Thread starter ABC
  • Start date Start date
A

ABC

I am always to write clases which has properties, is here any best tools or
method let me typing properties codes more fast?
 
ABC said:
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.
 

Ask a Question

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.

Ask a Question

Back
Top