Fw: [PHP] classes problem - am I being stupid?
| From: | Dan Larsen | Date: | Wed, 13 Sep 2000 14:44:51 +0000 |
| Subject: | Fw: [PHP] classes problem - am I being stupid? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16571@lists.php.net to get a copy of this message | ||
Hmmm...
It works fine for me :o(
Hope you get it working... :o)
Dan Larsen
> Please take a look at the following short piece of code:
>
>--- Start ---------
>
> <?
> class c1
> {
> function c1()
> {
> }
> function func1()
> {
> echo "This is c1::func1<BR>";
> }
> function func2()
> {
> echo "This is c1::func2<BR>";
> }
> }
>
> class c2 extends c1
> {
> function c2()
> {
> }
> function func1()
> {
> echo "This is c2::func1<BR>";
> }
> function func2()
> {
> echo "This is c2::func2<BR>";
> }
> }
>
> $c1 = new c1();
> $c1->func1();
>
> $c2 = new c2();
> $c2->func1();
> ?>
> --- End ------------
>
> ... and please tell me why it gives this output:
>
> This is c1::func1
>
> ... instead of this output:
>
> This is c1::func1
>
> This is c2::func1
>
> Sorry if I've done something dumb, but I've stared at it long enough and
can't see