#34936 [Opn->Bgs]: Base methods influenced by masking in derived classes
| From: | tony2001@php.net | Date: | Thu, 20 Oct 2005 17:54:30 +0000 |
| Subject: | #34936 [Opn->Bgs]: Base methods influenced by masking in derived classes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-86829@lists.php.net to get a copy of this message | ||
ID: 34936
Updated by: tony2001@php.net
Reported By: pa-engineer at web dot de
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: WinXP
PHP Version: 5.0.5
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2005-10-20 19:36:35] pa-engineer at web dot de
Description:
------------
Dieser Effekt hat weitreichende Konsequenzen für die
Funktionstüchtigkeit von Methoden die wiederum Methoden desselben
Objektes aufrufen, die unter dem Einfluss der Ableitung modifiziert
werden könnten.
Anstelle dessen: Basismethoden rufen auch Basismethoden auf, unberührt
von einer Verdeckung durch eine abgeleitete Klasse.
This Effect has a wide range of consequences in functionality of base
methods whitch call methods of the same object, perhaps influenced by
using modifikation in derived classes.
Instead: base methods simply call base methods, untoughed by using a
mask in derived classes.
Reproduce code:
---------------
class Class_A
{
public function Do_Something()
{
$this->Class_A_Method();
}
public function Class_A_Method()
{
echo "Class_A";
}
}
class Class_B extends Class_A
{
public function Class_A_Method()
{
echo "Class_B";
}
}
$Instance = new Class_B();
$Instance->Do_Something();
Expected result:
----------------
Die Ausgabe hier ist offensichtlich "Class_B".
Meine Erwartung, wie auch in anderen Sprachen: "Class_A".
The Output in this case here is obviously "Class_B"
My expectation, such as in other languages: "Class_A".
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34936&edit=1