%This system variable
Description
%This returns a reference to the current object.
Example
In the following example, both Banana and Apple are defined as subclasses of Fruit. When implemented, the Slice method of each subclass will override the Slice method of the superclass. In addition, Banana defines a Freeze method not found in the superclass; similarly, Apple defines a Juice method not found in the superclass.
import FRUIT:Fruit;
class Banana extends FRUIT:Fruit
method Banana();
method Slice(&slices As number);
method Freeze();
end-class;
method Banana
%Super = create FRUIT:Fruit();
%This.Color = "yellow";
end-method;
method Slice
/+ &slices as Number +/
/+ Extends/implements FRUIT:Fruit.Slice +/
end-method;
method Freeze
end-method;
---------------------------------------------
import FRUIT:Fruit;
class Apple extends FRUIT:Fruit
method Apple();
method Slice(&slices As number);
method Juice();
end-class;
method Apple
%Super = create FRUIT:Fruit();
%This.Color = "red";
end-method;
method Slice
/+ &slices as Number +/
/+ Extends/implements FRUIT:Fruit.Slice +/
end-method;
method Juice
end-method;
Related Topics