Object subclass: 'Point' instanceVariables: 'x y '
x
^x
x: coord
x := coord
y
^y
y: coord
y := coord
init
x := Float new.
y := Float new.
####
p := Point new.
p init.
p x: 1.5.
p y: 1.5.
####
my $p = bless {}, Point;
$p->init;
$p->x(1.5);
$p->y(1.5);
####
newX: xc Y: yc
p := Point new.
p init.
p x: xc.
p y: yc.
^p
####
Point newX: 1.5 Y: 1.5.
####
sub init
{
# Nothing to do, this is just here so classes don't have to define init
}
sub new
{
my $class = shift;
my $object = bless {}, $class;
$object->init(@_);
return $object;
}