Ask a Question

Static methods in classes in VBScript(TestComplete)

Occasional Contributor

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.


Bhausaheb Gurav
Champion Level 3

Hi Bhausaheb,

No, classes in VBScript are always dynamic, so you must first create an instance of the class and then call its method.
  /Alex [Community Champion]
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.

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.

Customer Care Manager
Showing results for 
Search instead for 
Did you mean: