Ask a Question

Static methods in classes in VBScript(TestComplete)

bhaugurav
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.



Thanks,

Bhausaheb Gurav
2 REPLIES 2
AlexKaras
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.
Regards,
  /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.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
AlexanderM
Staff


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.
-----

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