Zadejte hledaný výraz...

PHP5 – parent method call

Ahoj, resim nasledujici problem.. mam tridu
class IObject{
private $createdBy;
private $note;
protected function __construct($createdBy, $note){
$this->$createdBy = $createdBy;
$this->$note = $note;
}
public function store(){
...
}
a potomka
class CarObject extends IObject{
private $id;
private $spz;
private $vin;
private $manufacturer;
private $model;
private $madeInYear;
private $usingStartedIn;
private $weight;
private $parentClass;
public function __construct($createdBy, $note, $spz, $vin, $manufacturer, $model, $madeInYear, $usingStartedIn, $weight){
parent::__construct($createdBy, $note);
$this->$spz = $spz;
$this->$vin = $vin;
$this->$manufacturer = $manufacturer;
$this->$model = $model;
$this->$madeInYear = $madeInYear;
$this->$usingStartedIn = $usingStartedIn;
$this->$weight = $weight;
}
public function store(){
//super.store();
...
}
Ve funkci store ve tride CarObject bych potreboval mimo jine volat metodu store tridy Object. Neco jako java super. Problem je, ze pokud to delam pres parent::store(), nejak uz to nema odkaz na tu instanci predka, kterou vytvarim pod konstruktorem... Asi se nejak v potomkovi musi uchovavat odkaz na instanci predka... ale to je divny.. Diky
24. 10. 2008 13:45:01
https://webtrh.cz/diskuse/php5-parent-method-call/#reply145727
Hazi to chybu Cannot access empty property...
24. 10. 2008 13:46:46
https://webtrh.cz/diskuse/php5-parent-method-call/#reply145726
Pro odpověď se přihlašte.
Přihlásit