Compound data type: Difference between revisions
Content deleted Content added
→{{header|Python}}: === Dictionary === |
|||
Line 691:
Var:Point point;
}</lang>
=={{header|Lasso}}==
In Lasso, a point could just be stored in the pair type. However, assuming we want to be able to access the points using the member methods [Point->x] and [Point->y], let's just create a type that inherits from the pair type:
<lang lasso>define Point => type {
parent pair
public onCreate(x,y) => {
..onCreate(#x=#y)
}
public x => .first
public y => .second
}
local(point) = Point(33, 42)
#point->x
#point->y</lang>
{{out}}
<pre>33
43</pre>
=={{header|Logo}}==
|