Re: simple oop question: accessor function
- From: "conimex" <conimex@xxxxxxxxxxx>
- Date: Mon, 25 Apr 2005 13:18:31 +0200
> Because you haven't set the value of $toon->a.
the value of $toon->a is set in 'function set_vanA()'.
as far as i understand it, when you call function 'get_vanA()', it should
get automaticaly
the value from '$a' from the 'function set_vanA()';
i have got this from the book 'php and mysql webdevelopment' by Luke Welling
and Laura Thomson (second edition page 150-151);
------------------------- code -------------------------------
<?
class A{
var $a;
function set_vanA(){
$this->a = "hello";
}
function get_vanA(){
return $this->a;
}
}
$toon = new A();
echo $toon->get_vanA();
?>
-----------------------------------------------
.
- Follow-Ups:
- Re: simple oop question: accessor function
- From: Oli Filth
- Re: simple oop question: accessor function
- References:
- simple oop question: accessor function
- From: conimex
- Re: simple oop question: accessor function
- From: Oli Filth
- Re: simple oop question: accessor function
- From: conimex
- Re: simple oop question: accessor function
- From: Oli Filth
- simple oop question: accessor function
- Prev by Date: Re: simple oop question: accessor function
- Next by Date: Re: simple oop question: accessor function
- Previous by thread: Re: simple oop question: accessor function
- Next by thread: Re: simple oop question: accessor function
- Index(es):
Relevant Pages
|
Loading