Re: how to access private property?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx
> 2007-03-06
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux