ID: 34936 User updated by: pa-engineer at web dot de Reported By: pa-engineer at web dot de Status: Bogus Bug Type: Class/Object related Operating System: WinXP PHP Version: 5.0.5 New Comment:
Hallo Tony Danke für die schnelle Antwort. Sie denken die Ausgabe von Class_B ist richtig nun, vielleicht ist es kein Fehler aus Sicht ihrer Dokumentation, aber sicherlich nicht im Sinne moderner objektorientierter Mechanismen. Zu meiner Überraschung müsste ich den selben Fehler in JAVA feststellen, aber moderne Sprachen wie C# bestätigen meine Meinung den richtigen Ansatz denke ich! Wie denken Sie darüber? Stellen Sie sich vor, Sie wissen nicht, was innerhalb einer Basismethode Do_Something() vor sich geht. Können sie eine stabile Operation sicherstellen, wenn diese dem Einfluss der Verdeckung unterliegen? Sehen sie sich das Beispiel noch mal an. Hello Tony Thanks for your quick respons. You think output Class_B is right well, referring to your documentation it might not be a bug I dont know but apart from that and in the sense of usually object oriented mechanisms it surely is. Astonishingly, JAVA tells me the same bug, but modern object-oriented language like C# constans my opinion in my point of view the right way! What do you think? Image you dont know what happens inside a base method Do_Something(). Can you secure a solid operation influenced by masking its direction? Look at the example again and see what happens here. Best regards Daniel Previous Comments: ------------------------------------------------------------------------ [2005-10-20 19:54:29] [EMAIL PROTECTED] 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 ------------------------------------------------------------------------ [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
