What's wrong with the following code?
$inFile and $outFile get initialized ALWAYS by machine1 and not by machine2, which means that with an instance of machine2 the config of machine1 gets opened (and written).
What am I doing wrong?
I understood that $this->somevar
refers to the object actually instantiated (machine2).
Thanks.
class machine1
{
private $inFile = "Config.ini";
private $outFile = "Config.web";
public $fileArray = array();
public function LoadData()
{
$handle = fopen(paths::$inifiles . $this->inFile,"r");
// Read the file
fclose($handle);
}
public function SaveData()
{
$handle = fopen(paths::$inifiles . $this->outFile,"w");
//write the file
fclose($handle);
}
}
class machine2 extends machine1
{
private $inFile = "Config_1.ini";
private $outFile = "Config_1.web";
}
$obj = new machine2();
$obj->LoadData();
$obj->SaveData();