php - Does a child class automatically implement parent class's interface -
this porbably basic oop question i'm not answer, , couldn't find useful in google search (i.e. first page, of course)
if have class child of class implements interface, child class automatically become implementation of interface, or have be? so
interface htmlelementinterface { public function getname(); } abstract class htmlelement implements htmlelementinterface { protected $_name; public function __construct($name) { $this->_name = $name; } public function getname() { return $this->_name; } abstract public function __tostring(); } class textinput extends htmlelement { public function __tostring() { return "<input type='input' name='{$this->_name}' id='{$this->_name}' />\n"; } }
in case above, don't have tell textinput
implement htmlelementinterface
, i?
no, haven't. implicitly htmlelementinterface
implementation.
Comments
Post a Comment