Jmeno = $jm; $this->Prijmeni = $pr; $this->Ulice = $ul; $this->Obec = $ob; $this->PSC = $ps; } // funkce vypisuje data function Tisk($format=0) { if ($format == 0) { echo $this->Jmeno." ".$this->Prijmeni." ... "; echo $this->Ulice.", ".$this->Obec.", ".$this->PSC."
"; } elseif ($format == 1) { echo $this->Jmeno." ".$this->Prijmeni."
"; echo $this->Ulice."
"; echo $this->PSC.", ".$this->Obec."
"; } } // } class CFiremniAdresa extends CAdresa { var $Nazev; function CFiremniAdresa($na,$ul,$ob,$ps) { $this->CAdresa("","",$ul,$ob,$ps); $this->Nazev = $na; } function Tisk() { //nelze využít předkovu funkci echo $this->Nazev." : "; echo $this->Ulice.", ".$this->Obec.", ".$this->PSC."
"; } } ?>

Objekty

Jmeno = "Josef"; $adresa->Prijmeni = "Klimeš"; $adresa->Ulice = "Opavská 21"; $adresa->Obec = "Plzeň"; $adresa->PSC = "312 17"; $adresa->Tisk(); echo "
"; $adresa->Tisk(1); echo "
"; $adr1 = new CAdresa("Jan","Pecka","Dvořákova 40","Plzeň","320 07"); $adr1->Tisk(); echo "
"; $adr2 = new CAdresa(); $adr2->Tisk(); echo "

"; $firma = new CFiremniAdresa("Pieta","Hřbitovní 1","Plzeň","321 12"); $firma->Tisk(); ?>