- 在 ClassDef 中添加 abstractMethods 数组存储抽象方法 - 实现 addAbstractMethod 和 hasAbstractMethod 方法 - 添加 getMethodFlags 方法统一获取方法标志 - 在 Preprocessor 中解析并添加抽象方法到类定义 - 实现 guardAbstractMethod 防止调用抽象方法 - 在父类方法调用中添加抽象方法检查 - 更新单元测试验证抽象方法调用错误处理pull/1/head
parent
35f0775435
commit
dbcadeb873
5 changed files with 65 additions and 2 deletions
@ -0,0 +1,20 @@ |
||||
<?php |
||||
|
||||
abstract class AbsBase { |
||||
abstract function show(); |
||||
} |
||||
|
||||
class Child extends AbsBase { |
||||
function show() { |
||||
echo "Call to function show()\n"; |
||||
} |
||||
function error() { |
||||
parent::show(); |
||||
} |
||||
} |
||||
|
||||
function main() { |
||||
$t = new Child(); |
||||
$t->show(); |
||||
$t->error(); |
||||
} |
||||
Loading…
Reference in new issue