Call an object method: Difference between revisions

Content added Content deleted
m (→‎{{header|Wren}}: Changed to Wren S/H)
(PascalABC.NET)
 
Line 1,640: Line 1,640:
c~area: 3.14159265
c~area: 3.14159265
10 circles were created</pre>
10 circles were created</pre>
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="delphi">
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.
</syntaxhighlight>


=={{header|Perl}}==
=={{header|Perl}}==
<syntaxhighlight lang="perl"># Class method
<syntaxhighlight lang="perl"># Class method
Line 1,658: Line 1,679:
MyClass::classMethod('MyClass', $someParameter);
MyClass::classMethod('MyClass', $someParameter);
MyClass::method($myInstance, $someParameter);</syntaxhighlight>
MyClass::method($myInstance, $someParameter);</syntaxhighlight>

=={{header|Phix}}==
=={{header|Phix}}==
{{libheader|Phix/Class}}
{{libheader|Phix/Class}}