Hello,
I have the following directory structure:
/Program.php
/Sections/Section.php
/Sections/Inputs/Input.php
In Program.php I have the following:
require('Sections/Inputs/Input.php');
require('Sections/Section.php');
...
array_push($this->sections, new Section('ff', 'ff', new Input('title', 'text'))); // Where problem begins.
In Section.php I have:
private $input_type;
private $id;
private $headerTitle;
function __construct($id, $header, $input){
$this->id = $id;
$this->headerTitle = $header;
$this->input_type = input;
$this->input_type->make(); // DOES NOT WORK
// PHP Fatal error: Call to a member function make() on a non-object
}
Code for Input.php:
class Input {
private $display;
private $id;
public function __construct($id){
$this->id = $id;
$this->display = '';
}
public function make(){ error_log('Gets called, during creation, but can't access this method'); }
public function display(){
return $this->display;
}
public function getID(){
return $this->id;
}
I know this has something to do with reference and such, but I just don't understand what I'm doing wrong. I'm running PHP 5>.
Any help would greatly be appericated.