我需要帮助解决一些小问题...
这是我用于ATM的代码:
Dim ID As String
Dim _PinPad As PinPad
Dim _CashDespenser As CashDespenser
Dim _PrintManager As PrintManager
Dim _CardReader As CardReader
Public Sub New(ByVal _PinPad As PinPad, ByVal _CashDespenser As CashDespenser, ByVal _PrintManager As PrintManager, ByVal _CardReader As CardReader)
MyBase.New()
Me._PinPad = _PinPad
Me._CardReader = _CardReader
Me._CashDespenser = _CashDespenser
Me._PrintManager = _PrintManager
End Sub
Public Sub New(ByVal ID As String, ByVal _PinPad As PinPad, ByVal _CashDespenser As CashDespenser, ByVal _PrintManager As PrintManager, ByVal _CardReader As CardReader)
MyBase.New()
Me.ID = ID
Me._PinPad = _PinPad
Me._CardReader = _CardReader
Me._CashDespenser = _CashDespenser
Me._PrintManager = _PrintManager
End Sub
现在我正试图让它在Form的加载事件中实例化,如下所示:
Dim ThisATM As New ATM
Dim ThisKeyCard As New KeyCard("1234", "5678", "Mikki Monster")
ThisATM.getCashDespenser.Dispensecash()
ThisATM.getID()
ThisATM.getPinPad.checkpin()
ThisATM.getPrintManager.print("Pikachu Rules")
KeyCard课程运行良好,但ATM课程根本不起作用。似乎无法让我在“新ATM”位之后输入参数......你有什么建议? Link For an Image of the parameters
答案 0 :(得分:2)
您需要添加
Public Sub New()
MyBase.New()
End Sub
到您的ATM班级。然后你需要改变你的
MyBase.New()
其他构造函数中的语句
Me.New()