| Autor | Zpráva | ||
|---|---|---|---|
| návštěvník Profil * |
#1 · Zasláno: 21. 12. 2013, 15:38:48
<?php
class View_class{
public $ms;
function __contruct(){
$this->ms=new View_messages_class();
}
}
class View_messages_class{
private $numbers, $from_ids, $names, $ids, $subjects, $reads, $sentTimes, $colors;
function __contruct(){
$this->numbers=array(); $this->from_ids=array(); $this->names=array(); $this->ids=array(); $this->subjects=array(); $this->reads=array(); $this->sentTimes=array(); $this->colors=array();
}
public function addNumber(&$a){$this->numbers=$a;}
public function addFrom(&$a){$this->from_ids=$a;}
public function addName(&$a){$this->names=$a;}
public function addID(&$a){$this->ids=$a;}
public function addSubject(&$a){$this->subjects=$a;}
public function addRead(&$a){$this->reads=$a;}
public function addSent(&$a){$this->sentTimes=$a;}
public function addColor(&$a){$this->colors=$a;}
public function getNumbers(){return $this->numbers;}
public function getFrom(){return $this->from_ids;}
public function getNames(){return $this->names;}
public function getIDs(){return $this->ids;}
public function getSubjects(){return $this->subjects;}
public function getRead(){return $this->reads;}
public function getSent(){return $this->sentTimes;}
public function getColors(){return $this->colors;}
}
$view=new View_class;
var_dump($view);
?>Vypíše object(View_class)#9 (1) {
["ms"]=>
NULL
}Rád bych volal funkci $view->ms->addColor($color); ale takhle to nejde, protože z neznámého důvodu $view->ms není objekt. |
||
| Magnus123 Profil |
Ve třídě View_class máš špatně napsaný construct - chybí ti "s".
Edit: Koukám, že to máš špatně i v té druhé třídě. Konstruktor se píše "__construct()". |
||
| návštěvník Profil * |
#3 · Zasláno: 21. 12. 2013, 16:22:50
Díky
|
||
|
Časová prodleva: 13 let
|
|||
0