?php
class
Punt2D
{
var
$x
,
$y
;
var
$label
;
function
Punt2D($x
,
$y
)
{
$this
-
x
=
$x
;
$this
-
y
=
$y
;
}
function
zetLabel($label
)
{
$this
-
label
=
$label
;
}
function
haalPunt(
)
{
return
array("x
"
=
$this
-
x
,
"y
"
=
$this
-
y
,
"label
"
=
$this
-
label)
;
}
}
/
/
"$label
"
is
gedeclareerd
maar
heeft
geen
standaard
waarde
$p1
=
new
Punt2D(1.233
,
3.445)
;
print_r(get_object_vars($p1))
;
$p1
-
zetLabel("Punt
#1")
;
print_r(get_object_vars($p1))
;
?
|