-
Notifications
You must be signed in to change notification settings - Fork 0
Attributes
Instance attributes can be defined inside the class constructor. For example, the following class definition defines instance attributes x and y inside the constructor:
call class %*
%class%
:public-construct
call super %*
set %self%.x=0
set %self%.y=0
exit /b
Instance attributes may be added dynamically outside of the class constructor. For example, the following class definition adds the attribute z to the instance attribute if the public method myMethod is called.
call class %*
%class%
:public-myMethod
set %self%.z=0
exit /b
:public-construct
call super %*
set %self%.x=0
set %self%.y=0
exit /b
Static attributes are not directly implemented in objectbatch. However, as batch scripts have global scope, any script may be used to define global variables in place of static attributes. For example, to define static class attributes attr1 and attr2 for a given class MyClass, we may define the following script, static_MyClass:
set MyClass.attr1=0
set MyClass.attr2=0
We can then instantiate these static class attributes using:
call static MyClass
More information can be found in the home page, the quick start page and the examples.