...

View Full Version : Resolved class inheritance problem



Jahren
01-15-2010, 07:43 PM
hi, i'd like to know why
oIdee->mIdTravail = null;
in this case



abstract class Objet_Modifiable{
public $mIdBd;
public $mIdTravail;


function __construct(){
$this->mIdBd = -1;
$this->mIdTravail = -1;
}
}



class Redaction_Idee extends Objet_Modifiable{
private $mTitre;
private $mEstDesactive;

//Constructeur
function __construct(){
$this->mTitre = "";
$this->mEstDesactive = false;
}
}


I create a new Idee object :



$oIdee = new Redaction_Idee();
var_dump($oIdee);


the var dump shows that both $mIdBd and $mIdTravail are NULL even tho I use a constructor to initilize the values.
what's wrong with my basic thinknig?

Jahren
01-15-2010, 08:13 PM
oh wow...
I did not know I had to implicitly call

parent::__construct();

even without any arguments.
Sorry about that!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum