papadilbert
Programmer
I coded a simple example of a base class and child class. The base class has one filed and the Let and Get "dummy" properties to maintain it. The implementation of the Let and Get properties are coded in the child class.
The problem is that the child properties are not being executed. Instead, the parent properties are executed.
Here is more detail
I have a base class "clsSimple" that defines Private CustomerName as String.
In the base class I coded (abbreviated below):
Private Property Get CustomerName()
'empty
end Property
Private Property Let CustomerName()
'empty
end Property
----------------------
The child class is an Access form with a button.
In the child class I coded (abbreviated):
'----- aForm--------------
Implements clsSimple
Private Property Get clsSimple_CustomerName()
...code...
End Property
Private Property Let clsSimple_CustomerName()
...code...
End Property
Private Sub aButton_Click()
Dim objSim As clsSimple
Set objSim = New clsSimple
objSim.CustomerName = "George"
Set objSim = Nothing
End Sub
-------------
My expectation was that when aButton_Click() is executed, the statement objSim.CustomerName = "George" would execute the Set property of the child class, it being the implementation of the parent property.
Instead, the Set property of the base class is being executed.
Where have I gone wrong?
The problem is that the child properties are not being executed. Instead, the parent properties are executed.
Here is more detail
I have a base class "clsSimple" that defines Private CustomerName as String.
In the base class I coded (abbreviated below):
Private Property Get CustomerName()
'empty
end Property
Private Property Let CustomerName()
'empty
end Property
----------------------
The child class is an Access form with a button.
In the child class I coded (abbreviated):
'----- aForm--------------
Implements clsSimple
Private Property Get clsSimple_CustomerName()
...code...
End Property
Private Property Let clsSimple_CustomerName()
...code...
End Property
Private Sub aButton_Click()
Dim objSim As clsSimple
Set objSim = New clsSimple
objSim.CustomerName = "George"
Set objSim = Nothing
End Sub
-------------
My expectation was that when aButton_Click() is executed, the statement objSim.CustomerName = "George" would execute the Set property of the child class, it being the implementation of the parent property.
Instead, the Set property of the base class is being executed.
Where have I gone wrong?