Forum Discussion

bhaugurav's avatar
bhaugurav
Occasional Contributor
16 years ago

Static methods in classes in VBScript(TestComplete)

Is there any static methods(as we have in C++/C# programming language) which we can call using Class name.

For e.g

class ABC

    static function MyFunction()



    end function

end class



and I can call MyFunction using ABC.MyFunction() instead of object of class.



Thanks,

Bhausaheb Gurav

2 Replies

  • AlexKaras's avatar
    AlexKaras
    Community Hero
    Hi Bhausaheb,



    No, classes in VBScript are always dynamic, so you must first create an instance of the class and then call its method.

  • Hi Bhausaheb,





    Alexei is right, but instead of using classes, to get similar functionality, you can use script units and call methods by using UnitName.RoutineName. UnitName specifies the unit where the routine is located.