0
Following the pillar of encapsulation proposed in POO I arose the following doubt, when it is declared a daughter class, besides inheriting attributes and methods she also inherits the interface of her mother?
interface ContaUsuario {
public carregue($id,$nome);
}
class conta implements ContaUsuario {
protected $id;
private $nome;
public carregue($id,$nome){
$this->id = $id;
$this->nome = $nome;
}
}
When I declare the student class beyond it inherits this 2 attributes and 1 function it also inherits the interface or I would have to recreate it ?
she inherits the interface...
– guijob
An account class that implements Contausuario ... !!! would be correct.
– novic
I don’t get it @Virgilionovic.
– ayelsew
You’ll never inherit one
interface
, they are implemented ... Inheritance happens from classesAbstract
(who may also have methods that are implemented) andConcretas
!– novic