PDA

View Full Version : Implements Keyword in VBA



mapkn
08-05-2008, 12:42 PM
Hello,

Could someone please tell me what the Implements keyword in VBA is used for. From what I understand it is used in class modules, but I am not clear on what the purpose is and what can be done with this....any examples would be very grateful.

Thanks,

Mitul

Aussiebear
08-05-2008, 01:21 PM
Have a look at the Implements in VBA Help file, or failing that I've attached a word doc version of the topic from help.

Bob Phillips
08-05-2008, 01:34 PM
Implements in VBA is used to inherit an interface from another class. Unfortunatunately we don't get implementation inheritance, jus inyetface inheritance.

For instance, create a class called clsMaster with these properties



Public Property Get Name() As String

End Property
Public Property Let Name(val As String)

End Property

Public Property Get Age() As String
End Property
Public Property Let Age(val As String)

End Property


Then if you create a new class module and add this line after the Options statements



Implements clsMaster


then you have those properties automatically exposed to your new class, and by selecting clsMaster from the General dopdown list, you get the Let/Get properties in the Declarations dropdown, which auto creates those properties when selected.