Jump to content

Compound data type: Difference between revisions

PascalABC.NET
m (→‎{{header|Wren}}: Changed to Wren S/H)
(PascalABC.NET)
 
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}}==
135

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.