Compound data type: Difference between revisions
Content added Content deleted
m (→{{header|Wren}}: Changed to Wren S/H) |
(PascalABC.NET) |
||
Line 1,798: | Line 1,798: | ||
x, y: integer; |
x, y: integer; |
||
end;</syntaxhighlight> |
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}}== |
=={{header|Perl}}== |