Singly-linked list/Element definition: Difference between revisions

Content added Content deleted
(→‎{{header|Perl 6}}: mention pitfalls of Pair, and show custom type example)
Line 344: Line 344:
<lang elena>class Link
<lang elena>class Link
{
{
T<int> prop Item :: _item.
prop int Item;
T<Link> prop Next :: _next.
prop Link Next;
constructor new(int item, Link next)
constructor(int item, Link next)
[
{
_item := item.
Item := item;
_next := next.
Next := next
]
}
}</lang>
}</lang>