Home  >  Article  >  Backend Development  >  类继承并重载其中函数后,怎么用子类对象调用重载前父类的函数

类继承并重载其中函数后,怎么用子类对象调用重载前父类的函数

WBOY
WBOYOriginal
2016-06-13 13:12:16838browse

类继承并重载其中函数后,如何用子类对象调用重载前父类的函数
大家好:
我初学Php,看到继承和重载部分,请教个问题:
假设 class A { function my_func(...); }
class B extends A { function my_func(...) } 
上面2个类 A 和 B , B继承A ,B又重载了 A 中的 my_func 函数
现在建立B 对象 $obj_B = new B() ;
假设我要用 B 对象引用 A 中的 my_func 函数,
我怎么写呢?

------解决方案--------------------
貌似这叫重写,php好像不支持方法重载

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn