Home  >  Article  >  Backend Development  >  java软件工程师学php -14. 面向对象

java软件工程师学php -14. 面向对象

WBOY
WBOYOriginal
2016-06-13 10:50:07602browse

java程序员学php -14. 面向对象
相同点:
1.也是类+方法
2.也不允许多重继承
3.也有interface,可以利用interface实现多重继承
4.也有抽象类
5.也有静态方法
6.也可以通过final关键字禁止扩展

不同点:
1.class本身没有access modifier
2.属性和方法的默认的access modifier是public, 没有包可见性的概念,其它一样
3.不用为每个属性写getter和setter,有一套通用的__get()和__set()即可
4.允许类级别的常量,但不允许静态变量

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn