id,$this->type)=func_get_args(); $noa=func_get_args(); if (!isset($this->id)) { $thid->id=random_int(0,1000); $this->type="Animal"; } } public function __destruct() { } public function set_type($my_type){ $this->type=$my_type; } public function get_type() { return $this->type; } public function __toString() { } return "Animal id=".$this->id", type=".$this->type."\n"; } public function __clone() { return $this; } } class Dog extends Animal { public function __construct($id=null){ parent::__construct($id,'dog'); } public function __toString() { return "Dog id=".$this->id."\n"; } } $obj=new Animal(); print $obj; print $obj->id; print $obj->get_type(); $obj2=new Dog(103); print $obj2; ?>