While I’m digging more and more into VBScript, I learned that you can use the default keyword to mark a default method in a class.
First, we define a class MyClass where is default sub is myDefaultSub.
public class MyClass
public default sub myDefaultSub(p_value)
response.write p_value
end sub
public sub notADefaultSub(p_value)
response.write p_value
end sub
end class
Second, we instantiate MyClass and we use it.
dim objMyClass : set objMyClass = new MyClass
objMyClass("This is calling the default sub.")
objMyClass.notADefaultSub("This is not the default sub.")
Cheers :-)
Advertisement
[...] 参考链接:VBScript’s default keyword [...]
Pingback by VBS类构造函数与Default关键字 | Demon's Blog — October 20, 2011 @ 6:44 am