Calling a function from the parent class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

<?php
class A
{
   public function func() { echo "A"; }
}
class B extends A
{
   public function func() { echo "B"; }
}
$cls=new B();
$cls->func();  //echo: B
?>

How can I call func() of class A from $cls object (that when I call func() it will echo "A" and not "B")?

Changing functions names or declaring another function in class B that will call parent::func() are not good for me.

-thanks, Eli

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux