一个演示VBA类和继承例子
时间:2009-10-21 08:30 来源:网络 作者:朱亦文 阅读:次
正 文:
在VBA中通过接口模拟实现类继承的实例
Sub test() Dim mCustomer As New CCustomer Dim mSender As New CPerson With mCustomer .CustomerNumber = Me.txtNumber .Company = Me.txtCompany .Name = Me.txtName End With With mSender .Company = "北风试验室" .Name = "海陆空" End With ' 采用同一接口的约定 SendFollow mCustomer SendFollow mSender End Sub
Function SendFollow(obj As CPerson) As Boolean SendFollow = obj.SendFollowUp Debug.Print "Obj: " & TypeName(obj) End Function
注:CCustomer继承于CPerson(责任编辑:admin)
顶一下
(0)
0%
踩一下
(0)
0%
最新内容
推荐内容