Ask a Question related to PHP Notes, Design and Development.
-
mazsolt@yahoo.com #1
note 33724 added to keyword.parent
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
mazsolt@yahoo.com Guest
-
note 33977 added to keyword.paamayim-nekudotayim
A great way to implement enums in PHP is to use the :: operator. For instance, if I had a class FormField, with a member variable $Type, I could... -
note 33819 added to keyword.parent
Which versions of PHP support the "parent::"? Most of the other OOP related stuff includes info about required PHP version but for some reason this... -
note 33702 added to keyword.extends
Just a simple example about inheritance: class a1{ var $a=10; function a1($a){ $this->a=$a; } } class a2 extends a1{ -
note 31265 deleted from keyword.parent by didou
Note Submitter: emmix -> emmix@wa.home.pl ---- Problem comprehension the class extends and inheritance variables: class A { var $x;... -
note 31073 deleted from keyword.extends by didou
Note Submitter: eschatus@eschatus.com ---- As Zend seems not to include multiple inheritance available in the Zend 2.0 engine, I've made a...



Reply With Quote

