摘要:
<?php //通过abstract关键字定义一个抽象类 abstract class ACanEat{ //通过abstract关键字定一个不用具体实现的抽象方法eat() abstract public function eat($food); //抽象类中可以定义普通的方法,并具体实现 pub 阅读全文
摘要:
<?php interface ICanEat{ public function eat($food);} class Human implements ICaneat{ public function eat($food){ echo "Human eating".$food."\n"; } } 阅读全文
摘要:
接口的实现 那么这一通定义之后 通过实例化对象 $peroson1=new Human(); $person1->eat('apple'); 输出的结果就是 Human eating apple 那么输出结果应该是 Human eating apple Bool (true) <?php //int 阅读全文