I basically have two child classes which have the same parent class.
what I wish to do is create instances of both classes in one script in order to access some of their unique functions, im very rusty on this subject but it seems that it is not possible.
I get the error Fatal error: Cannot redeclare class MWS
I want to know what is the proper way to work around this?
Below is an example of my class structure
Parent class
class MWS{
funcion MWS(){}
}
Child class
require_once('mws.php');
class MWS_Orders extends MWS{
function MWS_Orders(){}
}
Child class
require_once('mws.php');
class MWS_Feed extends MWS{
function MWS_Feed(){}
}
index.php
require_once('mws_feed.php');
require_once('mws_orders.php');
$feed = new MWS_Feed();
$orders = new MWS_Orders();
Put the declaration of the parent class in its own file and
require_once()that file. Do not declare the parent class in each of the child class files and do not userequire()instead ofrequire_once().