Re: Parents constructor

From: Date: Fri, 24 Mar 2006 15:50:10 +0000
Subject: Re: Parents constructor
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-232547@lists.php.net to get a copy of this message
Pham Huu Le Quoc Phuc wrote:
I want to execute polymorphism.
...BUT the OP didn't ask about polymorphism and php doesn't support it at all anyway. if you want polymorphism either use another language, drop the requirement or figure out a workaround using some kind of decorator pattern
----- Original Message ----- From: "Robert Cummings" <robert@interjinn.com> To: "Pham Huu Le Quoc Phuc" <phucphlq@dsp.com.vn> Cc: "Peter Lauri" <peter@lauri.se>; "PHP-General" <php-general@lists.php.net> Sent: Friday, March 24, 2006 2:01 PM Subject: Re: [PHP] Parents constructor
On Fri, 2006-03-24 at 01:48, Pham Huu Le Quoc Phuc wrote:
In PHP, I can do the flowing code:
What you mean to say is that in PHP5 and only in PHP5 can you use interfaces... and that would only be true if the following code were correct.
interface A { function Get(); } class B extends A { function Get() {
       echo "class B";
} } class C extends A { echo "class C"; }
I'm very sure that the above class definition will generate a parse error... and correct me if I'm wrong (I'm not by the way), but don't you need to implement an interface versus extending it?
$a = new B(); $a->Get(); $a = new C(); $a->Get(); result: Class B Class C
At any rate, I fail to see the point of your response in relation to the OP's question. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'


« previous php.general (#232547) next »