摘要: <?php//如下面的类class MyClass{ /** * 测试函数 * 第一个参数必须为 OtherClass 类的一个对象 */ public function test(OtherClass $otherclass) { echo $otherclass->var; } /** * 另一 阅读全文
posted @ 2019-07-05 13:52 没事就更 阅读(148) 评论(0) 推荐(0) 编辑
摘要: PHP 5 新增了一个 final 关键字。如果父类中的方法被声明为 final,则子类无法覆盖该方法。如果一个类被声明为 final,则不能被继承。 属性不能被定义为 final,只有类和方法才能被定义为 final。 <?phpfinal class BaseClass { public fun 阅读全文
posted @ 2019-07-05 13:10 没事就更 阅读(198) 评论(0) 推荐(0) 编辑