It is because there is no constructor in the Conta
class.
Because, in the child class ContaPoupanca
, you called the constructor of the parent class which is Conta
like this:
parent::__construct($Agencia, $Codigo, $DataCriacao, $Titular, $Senha, $Saldo);
Therefore, to make this work, the parent class Conta
should have a constructor like this:
public function __construct($Agencia, $Codigo, $DataCriacao, $Titular, $Senha, $Saldo) {
// Do what you need to do here.
}
On a side note apart from this question, you haven’t defined the functions with an encapsulation keyword. That is either “public”, “private” or “protected”.
1
solved Error in the exercise of oop [closed]