Please refer this Code input
This code doesn't give the expected output
class User{
protected $name;
protected $age;
public function __construct($name, $age){
$this->name = $name;
$this->age = $age;
}
}
class Customer extends User{
private $balance;
public function __construct($name, $age, $balance){
$this->balance = $balance;
}
public function pay($amount){
return $this->name . ' paid $' . $amount;
}
}
$customer1 = new Customer('Adithya', 23, 50);
echo $customer1->pay(100);
It only gives this
Can someone please explain the reason?
parent::__construct($params, $go, $here). Also, we don't accept images of code here. I already formatted your code block from earlier, but in the future you need to do that yourself.User's constructor inCustomer's constructor usingparent::__construct().