this is my example:
class A
{
public function testing()
{echo “I am a function of class a”;}
}
require_once (“classa.php”);
class B
{
private $classa = new A();
public function getA()
{
return $this->classa;
}
}
and this is how I call in my php page:
require_once(classb.php)
$classb= new B ();
$classb->getA()->testing(); // not work
even I try to change classa to public and use:
$classb->{classa->testing()} // not work
$classb->{$classb->classa}()->testing() //not work
$classb->classa->testing() // not work
$classb::classa->testing() // not work
$classb::classa::testing() // not work
I know we can create some function in class b to call function from class a. But in class a, I create about 20 functions and i don’t want to create the same 20 functions in class b. I hope I can call it directly from class a.
Anyone know about this. Please help!