ID:               48807
 Updated by:       j...@php.net
 Reported By:      Denfie at gmx dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: ubuntu4.1
 PHP Version:      5.2.10
 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:
------------------------------------------------------------------------

[2009-07-05 16:40:49] Denfie at gmx dot net

Description:
------------
I want to extend a class C from another class class B who was extend 
from my abstract class A. I want to get the different value of the same

variable. So I initialize my variable "name"  and read the variable at

my function "__toString()", so please look to my code couse my english

is not the best ;) . its hard for me to explain.

Reproduce code:
---------------
abstract class A {
        public $name = "CLASS:A";
        public function __toString(){
                return " => ABSTRACT " . $this->name;
        }
}
class B extends A {
        public function __construct(){
                $this->name = "CLASS:B";
        }
        public function __toString(){
                return " => " . $this->name . parent::__toString();
        }
}
class C extends B {
        public function __construct(){
                parent::__construct();
                $this->name = "CLASS:C";
        }
}
$deb_b = new B();
$deb_c = new C();
printf("Result: Beginn B %s<br />", $deb_b);
printf("Result: Beginn C %s<br />", $deb_c);

Expected result:
----------------
Result: Beginn B = => CLASS:B => ABSTRACT CLASS:B
Result: Beginn C = => CLASS:C => ABSTRACT CLASS:C

Actual result:
--------------
Result: Beginn B => CLASS:B => ABSTRACT CLASS:A
Result: Beginn C => CLASS:C => CLASS:B => ABSTRACT CLASS:A


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48807&edit=1

Reply via email to