Oop

SLG29

Member
Joined
May 5, 2005
Messages
13
Programming Experience
Beginner
Can anyone help with an OOP problem I've got

This is my first crack at OOP and I've got to produce a payroll program consisting of an abstract base class employee and 4 derived classes, the base class includes an abstract readonly property called monthlypay

There are 2 buttons on the form clicking create instantiates the object and clicking display shows the information in a messagebox which has just been inputted in the textboxes this is firstname, lastname and monthlypay

This is what I have so far for creating say for example a new boss class object which is one of the derived classes

Boss class code

Public Overrides Function ToString() As String
Return "boss: " (this has to be in the form "boss: John Doe")
End Function

Public Overrides ReadOnly Property MonthlyPay() As String
Get
Return annualsalary /12
End Get
End Property

Create button code

Dim boss as New cboss(firstname, lastname, annualsalary)

Display button code
Dim boss as New cboss(firstname, lastname, annualsalary)
firstname = textbox1.text
lastname = textbox2.text
Dim strMessage As String
strMessage = boss.monthlypay & firstname & lastname

Problem I have is I can't display the info in the messagebox, does anyone know how the ToString and ReadOnly properties should be incorporated in the messagebox

Thanks
 
Top Bottom