?php class Country {var $NAME; var $TLD; function Country($name, $tld) {$this - NAME = $name; $this - TLD = $tld;} function print_info($prestr="") {echo $prestr ."Country: ".$this - NAME ."\n"; echo $prestr ."Top Level Domain: ".$this - TLD ."\n";}} $cntry = new Country("Peru" ,"pe"); echo "* Calling the object method directly\n"; $cntry - print_info(); echo "\n* Calling the same method indirectly\n"; call_user_method ("print_info", $cntry, "\t");?
?php class Pays {var $NOM; var $TLD; function Pays($nom, $tld) {$this - NOM = $nom; $this - TLD = $tld;} function print_info($prestr="") {echo $prestr ."Pays: ".$this - NOM ."\n"; echo $prestr ."Nom de domaine: ".$this - TLD ."\n";}} $unPays = new Pays("Pérou" ,"pe"); echo "* Appel de la méthode directement\n"; $unPays - print_info(); echo "\n* Appel de la méthode indirectement\n"; call_user_method ("print_info", $unPays, "\t");?