Hey thanks for reading this.
Say I have 3 classes and I want to combine those class into a core.
Example
<?php
class One {
public function get_me(){
echo 'Hello from class One. ';
}
}
class Two {
public function call_me(){
echo 'Hello from class Two. ';
}
}
class Three {
public function leave_me(){
echo 'Hello from class Three. ';
}
}
class Core {
public $one;
public $two;
public $three;
public function __construct(){
$this->one = new One;
$this->two = new Two;
$this->three = new Three;
}
}
$core = new Core;
$core->one->get_me();
$core->two->call_me();
$core->three->leave_me();
?>
This outputs
Hello from class One. Hello from class Two. Hello from class Three.
Normally all these classes would be in different files but you get the point.
I want to know if there is a way to use class One
and class Two
and class Three
's methods in class Core
as if it was it's own so I can use $code->get_me();
instead of $code->one->get_me();
without using class Core extends One
because I want to extend them all.
Any help?