Compound data type: Difference between revisions

PascalABC.NET
(Initial FutureBasic task solution added)
(PascalABC.NET)
 
(One intermediate revision by one other user not shown)
Line 1,798:
x, y: integer;
end;</syntaxhighlight>
 
=={{header|PascalABC.NET}}==
Classes in PascalABC.NET are reference types and records are value types.
<syntaxhighlight lang="pascal">
type
Point = class
x,y: integer;
constructor(x,y: integer) := (Self.x,Self.y) := (x,y);
end;
PointRec = record
x,y: integer;
constructor(x,y: integer) := (Self.x,Self.y) := (x,y);
end;
 
begin
var p := new Point(2,3);
Println(p.x,p.y);
var pr := new PointRec(4,5);
Println(pr.x,pr.y);
end.
</syntaxhighlight>
 
=={{header|Perl}}==
Line 2,801 ⟶ 2,822:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">class Point {
construct new(x, y) {
_x = x
217

edits