Parents clone : clone « Class « PHP






Parents clone

 
<?
    abstract class Dog {
            public function __clone( ) {
                    echo "In dog clone\n";
            }
    }

    class Poodle extends Dog {
            public $Name;
                    public function __clone( ) {
                    echo "In poodle clone\n";
                    parent::__clone( );
            }
    }

    $poppy = new Poodle( );
    $poppy->Name = "Poppy";

    $rover = clone $poppy;
?>
  
  








Related examples in the same category

1.clone class instance
2.Change class instance after clone
3.clone a class
4.Cloning an aggregated class
5.Copying Objects
6.Properly implementing cloning in aggregated classes