最好的方法从扩展类调用函数 [英] best way to call function from an extended class
本文介绍了最好的方法从扩展类调用函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 phpstorm
作为IDE。在我的 class.php
中,我开始了类
I am using phpstorm
as IDE. And in my class.php
, I started the class as
class MyClass extends Database{
function sample(){
$this->query();
}
}
query / code>在类
Database
中。但phpstorm显示警告,
the query()
is in the class Database
. But phpstorm shows a warning that
Method 'query' not found in class MyClass. Referenced method is not found in subject class.
但这个函数没有任何问题。
But the function is working without any problem.
这个代码样式有什么问题吗?或者我需要尝试不同的方法?我搜索了很多网站。但没有得到一个正确的答案。请帮忙。谢谢。
Is there any problem with this code style? Or Do I need to try a different approach? I searched many websites. But didn't get a proper answer. Please help. Thank you.
推荐答案
class MyClass extends Database{
function sample(){
parent::query();
}
}
这是否有效?
这篇关于最好的方法从扩展类调用函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文