I've been told I have to create a config.php file that will hold all of the classes.
For example let's say I have 3 classes.
Class 1: House
Class 2: myCar
Class 3: Road
And in config.php I call them:
$house = new house();
$mycar = new myCar();
$road = new Road();
and then I include that config.php file in every page, for example index.php.
But now, I want to extend class Road.
I can't include config.php in that class? Or include the other' class file in it while it is already included in config.php.
Is this the wrong way of setup for classes?
How can I extend classes without having errors.
Do I have to create a new object everytime?
Example:
Instead of including a config.php Ill do this:
/**
* Index.php
**/
include("class/house.class.php");
$class = new House();
echo $class->echoMe("hey");
And in every file I will do the same, by creating new objects, so then I can extend some specific classes when needed?