Compound data type: Difference between revisions

Content added Content deleted
m (→‎{{header|Sidef}}: simplified the code to uses a struct instead of a class)
(Added PowerShell)
Line 1,355: Line 1,355:
slot y = 0;
slot y = 0;
enddefine;</lang>
enddefine;</lang>

=={{header|PowerShell}}==
{{works with|PowerShell|5}}
<lang PowerShell>
class Point {
[Int]$a
[Int]$b
Point() {
$this.a = 0
$this.b = 0
}
Point([Int]$a, [Int]$b) {
$this.a = $a
$this.b = $b
}
[Int]add() {return $this.a + $this.b}
[Int]mul() {return $this.a * $this.b}
}
$p1 = [Point]::new()
$p2 = [Point]::new(3,2)
$p1.add()
$p2.mul()
</lang>
<b>Output:</b>
<pre>
0
6
</pre>


=={{header|PureBasic}}==
=={{header|PureBasic}}==