PHP 類別的 繼承 / 建解構子
PHP 類別的 繼承 / 建解構子
class BASE{ function BASE(){ print “constructor function same name with class”; } function __destruct(){ print “BASE destructed”; } } class CHILD extends BASE{ function __construct(){ parent::__construct(); print “CHILD constructed”; } function __destruct(){ parent::__destruct(); print “CHILD destructed”; } } |