note 77843 added to language.oop5.overloading
| From: | egingell at sisna dot com | Date: | Sat, 15 Sep 2007 12:12:49 +0000 |
| Subject: | note 77843 added to language.oop5.overloading | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130511@lists.php.net to get a copy of this message | ||
Small vocabulary note: This is *not* "overloading", this is "overriding".
Overloading: Declaring a function multiple times with a different set of parameters like this:
<?php
function foo($a) {
return $a;
}
function foo($a, $b) {
return $a + $b;
}
echo foo(5); // Prints "5"
echo foo(5, 2); // Prints "7"
?>
Overriding: Replacing the parent class's method(s) with a new method by redeclaring it like
this:
<?php
class foo {
function new($args) {
// Do something.
}
}
class bar extends foo {
function new($args) {
// Do something different.
}
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 168.103.189.249
----
Manual Page -- http://www.php.net/manual/en/language.oop5.overloading.php
Edit -- https://master.php.net/note/edit/77843
Del: integrated -- https://master.php.net/note/delete/77843/integrated
Del: useless -- https://master.php.net/note/delete/77843/useless
Del: bad code -- https://master.php.net/note/delete/77843/bad+code
Del: spam -- https://master.php.net/note/delete/77843/spam
Del: non-english -- https://master.php.net/note/delete/77843/non-english
Del: in docs -- https://master.php.net/note/delete/77843/in+docs
Del: other reasons-- https://master.php.net/note/delete/77843
Reject -- https://master.php.net/note/reject/77843
Search -- https://master.php.net/manage/user-notes.php