-
Notifications
You must be signed in to change notification settings - Fork 0
Encapsulation
Objectbatch supports the following method types:
A public method in objectbatch needs to be prefixed by the public method prefix -public. For example, to define a method myMethod in a class definition file, we may write:
:public-myMethod
echo public method
exit /b
To call the method myMethod defined above from outside the class for a given object obj, we may use the following syntax:
call # obj myMethod
Note that we do not need to specify the public- prefix when calling the method outside the class, as the prefix is automatically added when executing the class header.
Private methods in objectbatch do not use the public method prefix -public and are thus not callable from outside the class. However, they may be called using normal batch label call syntax from within the class, e.g.:
:myPrivateMethod
echo this is a private method
exit /b
:public-myMethod
call :myPrivateMethod
exit /b
Static methods in objectbatch are public methods which do not require access to a class instance. We may use the following syntax to call a given static method myMethod for a given class MyClass:
call MyClass static myMethod
More information can be found in the home page, the quick start page and the examples.