> Home
v User Guide
    > Introduction
    > Hello World
    > Flow Control
    > Function Calls
    > Authentication
    > Database access
    > Content Management
    > Remote Calling
    v Object-Oriented
       o Constructor
       o Object function
       o Polymorphism
       o Inheritance
       o Object within an object
    > Other Features
> Reference
> Portal Object
> Development Guide

sys Class
debug Class
Intrinsic Conversions
>> User Guide >> Object-Oriented >> Constructor <=  =>      <  1  >  

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



<bee var="myVehicle%function:new" value="vehicle">

<beemyVehicle%new m="Toyota" c="4">



Previous Page       Next Page

Accsoft Computer Technology Pty Ltd     ABN: 98 065 617 549
PO Box 892, Epping NSW 1710         Level 1, Epping Office Park, 242 Beecroft Rd, Epping NSW 2121, Australia
Tel: Sydney - (02)98691668     National - 1300-881668         Fax: (02)98691866
© Copyright 2003 Accsoft Computer Technology Pty Ltd