LotusScript类的继承

最近在修改产品时,时常遇到需要修改一个自定义类的方法,但是这个类又不能给整个(代码保密),这时如何调试就变得很麻烦了。下面通过类的继承就可以很方便的解决这个问题了。

 

Option Public

Class TestClass1
  Public Function fun1

    MsgBox "TestClass1  fun1"

  End Function

  Public Function fun2

    MsgBox "TestClass1 fun2"

  End Function

End Class
 

Class TestClass2 As TestClass1

  Public Function fun1

    MsgBox "TestClass2   fun1"

  End Function 

End Class

 

Sub Initialize

Dim t1 As New TestClass1

Dim t2 As New TestClass2

 

Call t1.fun1()                                        'print TestClass1  fun1

Call t2.fun1()                                        'print TestClass2  fun1

Call t1.fun2()                                        'print TestClass1  fun2

Call t2.fun2()                                        'print TestClass1  fun2

End Sub

 

 

posted @ 2013-02-06 14:14  小爱博客  阅读(253)  评论(0编辑  收藏  举报