Polymorphism
Username:  
Password:
  > 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


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

Polymorphism in the OO world is implemented with function reference.  Every object class has a "function" variable, of which every element is a definition of a function name.  For example:

var car1%model = "Camry";

var car2%model = "Diablo";

 

var car1%function:whatType = "familyCar";

var car2%function:whatType = "playCar";

 

function familyCar

{

   display "{this%model} is a car for the family.";

}

 

function playCar

{

   display "{this%model} is for fun.";

}

 

car1%whatType;  // Camry is a car for the family.

car2%whatType;  // Diablo is for fun.

 

 

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