Option Explicit
' Loan Properties
Public PrincipalAmount As Variant
Public InterestRate As Variant
Public LoanNumber As Variant
Public Term As Variant
Private Sub Class_Initialize()
PrincipalAmount = 0
InterestRate = 0.08
LoanNumber = 0
Term = 36
End Sub
Public Property Get Payment() As Variant
Payment = Application.WorksheetFunction.Pmt _
(InterestRate / 12, Term, -PrincipalAmount)
End Property
Sub TestSimpleLoan()
Dim objLoan1 As New SimpleLoan
Dim objLoan2 As SimpleLoan
Set objLoan2 = New SimpleLoan
objLoan1.LoanNumber = 1
objLoan2.LoanNumber = 2
Debug.Print "objLoan1.LoanNumber is: " & objLoan1.LoanNumber
Debug.Print "objLoan2.LoanNumber is: " & objLoan2.LoanNumber
Set objLoan1 = Nothing
Set objLoan2 = Nothing
End Sub
|