Re: how to access private property?
| From: | Németh Zoltán | Date: | Tue, 06 Mar 2007 12:14:32 +0000 |
| Subject: | Re: how to access private property? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249921@lists.php.net to get a copy of this message | ||
2007. 03. 6, kedd keltezéssel 20.08-kor Nicholas Yim ezt írta:
> Hello Everyone,
>
> [code]
> class MyClass {
> private $prop;
> }
> $obj=new MyClass;
> [/code]
>
> is there anyway to read and write MyClass->prop, except serialize
write methods to do this
class MyClass {
private $prop;
function getProp() {
return $this->prop;
}
function setProp($val) {
$this->prop = $val;
}
}
greets
Zoltán Németh
>
> Best regards,
>
> Nicholas Yim
> nick.yim@taowap.com
> 2007-03-06
>