note 33724 added to keyword.parent

From: Date: Sat, 05 Jul 2003 08:04:16 +0000
Subject: note 33724 added to keyword.parent
Groups: php.notes 
Request: Send a blank email to php-notes+get-51547@lists.php.net to get a copy of this message
There is a difference between PHP and C# managing the overloaded variables of the parent class: [PHP] class a{ var $a=1; function display(){ echo $this->a; } } class b extends a{ var $a=9; } $x=new b; $x->display(); // will display 9 The same code in C# will display the value from the parent class. [C#] class a{ private int a=1; public int display(){ return this.a; } } class b:a{ private int a=9; } b x = new b(); Response.Write(b.display()); // will display 1 ---- Manual Page -- http://www.php.net/manual/en/keyword.parent.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33724 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33724&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33724&report=yes

« previous php.notes (#51547) next »