I have this code:
class A
{
public $db
}
class B
{
public $cssA
public function __construct()
{
$this->cssA = new A();
}
}
The question is, how can I call a method in class B from class A?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t as there is no reference to the object of class
B.Methods of object of class
Bcan be now accessed through$this->b->doSomething()within object of classA.