<?php abstract class shopping { public function buy() { echo "buy"; } public function loan() { echo "loan"; } } class leslieBuy extends shopping { } //$test1=new shopping;//直接语法错误 $leslieSie = new leslieBuy; $leslieSie->loan();//打印出loan ?>
以上这篇详谈PHP中public,private,protected,abstract等关键字的用法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。
您可能感兴趣的文章: