Home > Backend Development > PHP Tutorial > 帮小弟我解决个小疑点,多谢

帮小弟我解决个小疑点,多谢

WBOY
Release: 2016-06-13 13:16:37
Original
980 people have browsed it

帮我解决个小问题,谢谢
abstract class abs_db{//抽象类
abstract protected function connect();//数据库连接
abstract protected function select_db();//选择数据库
abstract protected function setchar();//字符设置
abstract protected function query();//查询
abstract protected function getAll(); //取出查询的一部分
abstract protected function getOne();//取出查询的一个
abstract protected function error();
}
class mysql extends abs_db{
}

?>

以上代码出现报错提示Class 'mysql' must implement inherited abstract method 
 'error(...)' 请问这是什么原因,怎么解决?我用的编译器是zend studio 9.0.3 版本。

------解决方案--------------------
就是说,一个子类继承一个父类,这个父类是抽象类,那么你在子类的class内,必须把父类中的函数都实现。
例如:

PHP code

abstract class A{
   funcA();
} <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template