Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 19

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 20

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 21

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 22

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 23
类与对象 - Hello World

类与对象

清歌
2022-11-01 / 0 评论 / 0 阅读 / 正在检测是否收录...
面对对象的三大特征:封装、继承、多态

封装

语法:

class  类名  
{访问权限:属性/行为}

类在设计时,可以把属性和行为放在不同的权限下,加以控制


public 公共权限 类内可以访问 类外可以访问
protected 保护权限 类内可以访问 类外不可以访问
private 私有权限 类内可以访问 类外不可以访问


0

评论 (0)

取消