N
Nick Foster
I have created an abstract base class and several classes that inherit it.
i.e.
Public MustInherit Class Person
Public Property Name
......
End Property
Public MustOverride Sub Add()
End Class
Public Class Employee
Inherits Person
Public Property Salary
......
End Property
Public Overrides Sub Add()
....
End Sub
End Class
Public Class Customer
Inherits Person
Public Property LastOrder
.......
End Property
Public Overrides Sub Add()
....
End Sub
End Class
I am trying to create a new object and set it's properties in an asp.net
page
Dim bloke as Person
Select Case PersonType
Case 1
bloke = New Employee
bloke.Salary = intSalary
Case 2
bloke = New Customer
bloke.LastOrder = intOrderNumber
End Select
bloke.Name = strName
bloke.Add
When I try to compile this it fails, telling me that Salary is not a member
of Person even though at runtime the behaviour of bloke would be as an
Employee. Is there a way to get to the Salary property of the Employee
class?
Thanks,
Nick
i.e.
Public MustInherit Class Person
Public Property Name
......
End Property
Public MustOverride Sub Add()
End Class
Public Class Employee
Inherits Person
Public Property Salary
......
End Property
Public Overrides Sub Add()
....
End Sub
End Class
Public Class Customer
Inherits Person
Public Property LastOrder
.......
End Property
Public Overrides Sub Add()
....
End Sub
End Class
I am trying to create a new object and set it's properties in an asp.net
page
Dim bloke as Person
Select Case PersonType
Case 1
bloke = New Employee
bloke.Salary = intSalary
Case 2
bloke = New Customer
bloke.LastOrder = intOrderNumber
End Select
bloke.Name = strName
bloke.Add
When I try to compile this it fails, telling me that Salary is not a member
of Person even though at runtime the behaviour of bloke would be as an
Employee. Is there a way to get to the Salary property of the Employee
class?
Thanks,
Nick