RE: [PHP4BETA] OOP issue
| From: | Samuel Liddicott | Date: | Wed, 17 Nov 1999 10:26:31 +0000 |
| Subject: | RE: [PHP4BETA] OOP issue | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-6349@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: root@gateway.digiintranet.ro
> [mailto:root@gateway.digiintranet.ro]On Behalf Of Teodor Cimpoesu
> Sent: Tuesday, November 16, 1999 06:53 PM
> Cc: php4beta@lists.php.net
> Subject: Re: [PHP4BETA] OOP issue
>
> I think it sounds more like `real' OO behaviour, though I would expect
> Y::x() to be called even Y::y() exists.
> Also the support for `var $v' declarations breaks some things like in
> class A {
> function A() {
> $this->a = 1;
> }
> };
> class B extends A {
> var $a = 2;
> function foo(){echo $this->a;}
> };
> $z = new B;
> echo $z->foo();
>
> This won't output 2 as expected but 1.
My Delphi 00 experience would lead me to expect 1.
Sure, B gets instatiated with $a=2, but pretty quicky the constructor gets
called in the superclass which sets it to 1.
This seems natural to me.
Sam