Since BEE Objects are just Classes, you can create an object out of thin air by assigning values into the class variables.
Alternatively, you can create an object with a Constructor function. You define the Constructor function that initialise the class variables through the "this" class. Then you call this Constructor function with the class name prefix. For example:
function vehicle
{
var this%make = "(var)arg%m";
var this%capacity = "(var)arg%c";
}
myVehicle%vehicle m="Toyota" c="4";
Every class has a special variable called "function", which contains the references to all the functions (or methods) associated with that class.
For example, var myVehicle%function:new = "vehicle" will define a function "myVehicle%new", which will refer to the function "vehicle" when it is called. In that case, the constructor call can be rewritten in the following way:
var myVehicle%function:new = "vehicle";
myVehicle%new m="Toyota" c="4";
There is a special syntax to express the above in one statement:
var myVehicle% = new vehicle m="Toyota" c="4";
The "new" operator is commonly used in calling the constructor, instead of direct call in the first two examples.
However, in BEE Tag, there is not "new" operator and you need to use direct call as in the following:
<beemyVehicle%vehicle m="Toyota" c="4">
or
<bee var="myVehicle%function:new" value="vehicle">
<beemyVehicle%new m="Toyota" c="4">
|