PHP
clone
keyword copies all member variables and then calls __clone
. <?php 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; ?>
26 of 33