PHP抽象类与接口的区别实例详解(2)

<?php interface a { const b = 'Interface constant'; } // 输出接口变量 echo a:b; // 错误的写法,因为常量不能被覆盖。 // 接口常量的概念和类常量的是一样的。 class b implements a { const b = 'Class constant' }

更多关于PHP相关内容感兴趣的读者可查看本站专题:《php面向对象程序设计入门教程》、《PHP数组(Array)操作技巧大全》、《PHP基本语法入门教程》、《PHP运算与运算符用法总结》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/a908f5bec1885e767c079c5b6193b909.html