VBA: is there something like Abstract Class?

后端 未结 3 740
眼角桃花
眼角桃花 2020-12-29 10:51

I\'m using an interface to ensure some similar classes implements some mandatory methods (subs/functions).

Example:

  • interface I1 declares M1 and M2 me
3条回答
  •  心在旅途
    2020-12-29 11:21

    There is no inheritance in VBA.

    You can define an interface and you can implement it in a class by using the Implements keyword. But if you want shared functionality pre-implemented by a base class, you have to use the copy-paste approach.

    Related reading:
    How to use the Implements in Excel VBA
    How to use comparison methods between class object modules in VBA in a similar manner as VB.NET?

提交回复
热议问题