Re: [PHP4BETA] OOP issue
| From: | Teodor Cimpoesu | Date: | Tue, 16 Nov 1999 18:52:56 +0000 |
| Subject: | Re: [PHP4BETA] OOP issue | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-6309@lists.php.net to get a copy of this message | ||
Kristian Köhntopp wrote:
>
> Andi Gutmans wrote:
> > In PHP 4 if the child doesn't define a constructor it's supposed to
> > inherit the parents constructor. Only if you override the constructor do
> > you need to call the parent constructor explicitly.
>
> Did I understand this correctly: When I define a class Y extends X without
> providing Y::y() and X::x() is a constructor in X, a $y = new Y does
> call Y::x()?
>
> Ok, that works and it is probably the most confusing way to implement it.
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.
--
CIMPOESU Teodor, Web Programmer
@ DIGICOM S.A. Bucharest, Romania
@ Internet, site development
@ teo@digiro.net , +(401)-330.47.28
official home page ~ http://www.digiro.net/
Internet web page ~ http://internet.digiro.net/