note 78388 added to language.oop5.abstract
| From: | sneakyimpathotmaildotcom at osu1 dot php dot net | Date: | Wed, 10 Oct 2007 00:05:57 +0000 |
| Subject: | note 78388 added to language.oop5.abstract | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131260@lists.php.net to get a copy of this message | ||
Ok...the docs are a bit vague when it comes to an abstract class extending another abstract class.
An abstract class that extends another abstract class doesn't need to define the abstract
methods from the parent class. In other words, this causes an error:
[php]
abstract class class1 {
abstract public function someFunc();
}
abstract class class2 extends class1 {
abstract public function someFunc();
}
[/php]
Error: Fatal error: Can't inherit abstract function class1::someFunc() (previously declared
abstract in class2) in /home/sneakyimp/public/chump.php on line 7
However this does not:
[php]
abstract class class1 {
abstract public function someFunc();
}
abstract class class2 extends class1 {
}
[/php]
An abstract class that extends an abstract class can pass the buck to its child classes when it
comes to implementing the abstract methods of its parent abstract class.
----
Server IP: 69.147.83.197
Probable Submitter: 76.174.207.198
----
Manual Page -- http://www.php.net/manual/en/language.oop5.abstract.php
Edit -- https://master.php.net/note/edit/78388
Del: integrated -- https://master.php.net/note/delete/78388/integrated
Del: useless -- https://master.php.net/note/delete/78388/useless
Del: bad code -- https://master.php.net/note/delete/78388/bad+code
Del: spam -- https://master.php.net/note/delete/78388/spam
Del: non-english -- https://master.php.net/note/delete/78388/non-english
Del: in docs -- https://master.php.net/note/delete/78388/in+docs
Del: other reasons-- https://master.php.net/note/delete/78388
Reject -- https://master.php.net/note/reject/78388
Search -- https://master.php.net/manage/user-notes.php