Creating Custom Objects
Option Explicit
Private m_LastName As String
Private m_FirstName As String
Private m_Salary As Currency
Private m_Id As String
Property Get Id() As String
Id = m_Id
End Property
Property Get LastName() As String
LastName = m_LastName
End Property
Property Get FirstName() As String
FirstName = m_FirstName
End Property
Property Get Salary() As Currency
Salary = m_Salary
End Property
Property Let Id(ref As String)
m_Id = ref
End Property
Property Let LastName(L As String)
m_LastName = L
End Property
Property Let FirstName(F As String)
m_FirstName = F
End Property
Property Let Salary(ByVal dollar As Currency)
m_Salary = dollar
End Property
Public Function CalcNewSalary(choice As Integer, curSalary As Currency, _
amount As Long) As Currency
Select Case choice
Case 1 ' by percent
CalcNewSalary = curSalary + ((curSalary * amount) / 100)
Case 2 ' by amount
CalcNewSalary = curSalary + amount
End Select
End Function
Related examples in the same category