Is there a way to overload the constructor / initialize procedure for a class in VBA?

前端 未结 4 881
时光取名叫无心
时光取名叫无心 2020-12-11 04:37

In C#, I know that I can overload the constructor for a class by specifying it in the body of the class:

public class MyClass()
{
    public MyClass(String s         


        
4条回答
  •  春和景丽
    2020-12-11 05:30

    Class Constructor Methods and overloading the Class constructor In Visual Basic 6.0, the class Initialize event handler named Class_Initialize is used to execute code that needs to be executed at the moment that an object is created.

    In Visual Basic 2005, one or more constructors are added to a class to execute code and initialize variables. Constructors are the methods in a class that are named New. The New method can be overloaded to provide multiple constructors with the name New within the same class statement.

    For more information, see New (Visual Basic) or Using Constructors and Destructors. http://msdn.microsoft.com/en-us/library/55yzhfb2(v=vs.80).aspx

提交回复
热议问题