I found a piece of code in the docs, and thought it was a way to EXTEND a
Class with new properties tha cna be accessed from original Class Object.

can someone tell me what I did wrong?

Thx

Walter

=====================

<?php


class THEPARENT {
 var $name = null;

 function THEPARENT( $newName )
 {
  $this->name =  $newName ;
 }
}

class THECHILD extends THEPARENT {

    var $abc;
    var $xyz = "xyz"; // NOTE: this value will be lost during
unserialization

    function _ATOM() {

        // NOTE: $this->xyz is now "xyz"
        $this = unserialize (serialize (new THEPARENT()));
        // NOTE: Original value of $this->xyz is lost

        $this->$abc = "abc"; // Better: initialize values after ser/unser.
step
    }
}

$a = new THEPARENT ('walter');

echo $a->name . '<p />';

echo $a->abc . '<p />';

?>

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

Reply via email to