Ask a Question related to PHP Notes, Design and Development.
-
didou@php.net #1
note 31265 deleted from keyword.parent by didou
Note Submitter: emmix -> [email]emmix@wa.home.pl[/email]
----
Problem comprehension the class extends and inheritance variables:
class A {
var $x;
function val() { return $this->x; }
}
class B extends A {
function B() { echo(parent::val()); }
}
...............
$a1=new A; $a1->x=1; // $x in $a1 have value 1
$a2=new A; $a2->x=2; // $x in $a2 have value 2
$b=new B; // result: !isset or 0.
...............
new B use procedure "val" from class A. Both object $a1 and $a2 have some physical procedures. But variables have different physical! Thus function "val" consumption variable $x from $a1, if from $a2 ?. HOW COME function val() MUST HAVE knowledgle where from use variable $x ?.
didou@php.net Guest
-
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 21357 deleted from function.is-a by didou
Note Submitter: krisher@oswego.edu ---- Any implementation of is_a that relies on empty() to test whether the object parameter is empty will... -
note 25356 deleted from function.get-parent-class by didou
Note Submitter: apex@prezent.nl ---- Overloading functions <? class basic { function test() { echo "Basic\n"; } -
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

