⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ccommissionworker2.cls

📁 Visual Basic 6 大学教程的代码
💻 CLS
字号:
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "CCommissionWorker2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
' CCommissionWorker2 definition
Option Explicit
Implements IEmployee2

Private mEmployee As IEmployee2
Private mSalary As Currency
Private mCommission As Currency
Private mQuantity As Long

Private Sub Class_Initialize()
   Set mEmployee = New IEmployee2
End Sub

Public Property Let Salary(ByVal w As Currency)
   mSalary = IIf(w > 0, w, 0)
End Property

Public Property Get Salary() As Currency
   Salary = mSalary
End Property

Public Property Let Commission(ByVal c As Currency)
   mCommission = IIf(c > 0, c, 0)
End Property

Public Property Get Commission() As Currency
   Commission = mCommission
End Property

Public Property Let Quantity(ByVal q As Long)
   mQuantity = IIf(q > 0, q, 0)
End Property

Public Property Get Quantity() As Long
   Quantity = mQuantity
End Property

Private Function IEmployee2_Earnings() As Double
   IEmployee2_Earnings = mSalary + mCommission * mQuantity
End Function

Private Function IEmployee2_ToString() As String
   IEmployee2_ToString = "Commission worker: " & _
                         mEmployee.FirstName & _
                         " " & mEmployee.LastName
End Function

Private Property Let IEmployee2_FirstName(ByVal fName _
                                          As String)
   mEmployee.FirstName = fName
End Property

Private Property Get IEmployee2_FirstName() As String
   IEmployee2_FirstName = mEmployee.FirstName
End Property

Private Property Let IEmployee2_LastName(ByVal name As String)
   mEmployee.LastName = name
End Property

Private Property Get IEmployee2_LastName() As String
   IEmployee2_LastName = mEmployee.LastName
End Property

Private Sub Class_Terminate()
   Set mEmployee = Nothing
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -