Ask a Question related to PHP Notes, Design and Development.
-
mazsolt@yahoo.com #1
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{
var $x=11;
function a2($x,$y){
$this->x=$x;
parent::a1($y); // or a1::a1($y) or $this->a1($y)
}
}
class a3 extends a2{
var $q=999;
}
$x=new a3(99,9);
echo $x->a,"<br>",$x->x,"<br> ",$x->q;
The output will be:
9
99
999
----
Manual Page -- [url]http://www.php.net/manual/en/keyword.extends.php[/url]
Edit Note -- [url]http://master.php.net/manage/user-notes.php?action=edit+33702[/url]
Delete Note -- [url]http://master.php.net/manage/user-notes.php?action=delete+33702&report=yes[/url]
Reject Note -- [url]http://master.php.net/manage/user-notes.php?action=reject+33702&report=yes[/url]
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 33724 added to keyword.parent
There is a difference between PHP and C# managing the overloaded variables of the parent class: class a{ var $a=1; function display(){ echo... -
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

