17 lines
367 B
ObjectPascal
17 lines
367 B
ObjectPascal
type
|
|
Point = auto class // class with autogenerated constructor
|
|
x,y: real;
|
|
static function RandomPoint := new Point(Random(-10..10),Random(-10..10));
|
|
procedure Print;
|
|
begin
|
|
Writeln($'{x} {y}');
|
|
end;
|
|
end;
|
|
|
|
begin
|
|
var p := new Point(2,3);
|
|
p.Print; // instance method call
|
|
p := Point.RandomPoint; // static method call
|
|
p.Print;
|
|
end.
|