Németh Zoltán wrote:
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;
        }
}

You could also use the __get() and __set() methods to write a generic handler for all of your private vars.

http://uk.php.net/manual/en/language.oop5.overloading.php

Mikey

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

Reply via email to