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" <[EMAIL PROTECTED]>
To: "Pham Huu Le Quoc Phuc" <[EMAIL PROTECTED]>
Cc: "Peter Lauri" <[EMAIL PROTECTED]>; "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.          |
`------------------------------------------------------------'




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to