Re: extends in php

From: Date: Tue, 28 Feb 2012 12:10:00 +0000
Subject: Re: extends in php
References: 1  Groups: php.evangelism 
Request: Send a blank email to php-evangelism+get-521@lists.php.net to get a copy of this message
The extends keyword serves to declare inheritance, from the parent class (the one that is extended) to a child class. When declaring something like Dog extends Animal, the Dog class becomes a subclass, that obtains all the methods declared in Animal, unless you overwrite them in the Dog declaration. If you redeclare a method, you can still call the parent method by: parent::method(); You should take a look at: http://es.php.net/manual/en/language.oop5.php -- Vicenc Gasco vicenc@idako.us On Feb 28, 2012, at 1:03 PM, jimmy he <jimmyjingjiang@gmail.com> he wrote: > how does extend of php implement? it has much difference with c++/java, i think.is it a simple > combination of functions in parent class and itself?

« previous php.evangelism (#521) next »