摘要:
成员属性私有化设置 点击查看代码 #include<iostream> #include<string> using namespace std; //成员属性设置为私有 //1、可以自己控制读写权限 (提供接口) //2、对于写可以检测数据的有效性 class Person { public: / 阅读全文
posted @ 2021-07-19 16:02
毋纵年华
阅读(59)
评论(0)
推荐(0)
摘要:
class和struct的区别 点击查看代码 #include<iostream> #include<string> using namespace std; //struct和class区别 //struct 默认权限是 公共public //class 默认权限是 私有private class 阅读全文
posted @ 2021-07-19 15:05
毋纵年华
阅读(51)
评论(0)
推荐(0)
摘要:
封装意义 点击查看代码 #include<iostream> #include<string> using namespace std; //访问权限 //三种 //公共权限(public) 成员类内可以访问 类外可以访问 //保护权限(protected) 成员类内可以访问 类外不可以访问(继承性 阅读全文
posted @ 2021-07-19 14:46
毋纵年华
阅读(41)
评论(0)
推荐(0)
摘要:
类和对象 、封装 点击查看代码 #include<iostream> using namespace std; const double PI = 3.14; //class 代表设计一个类,类后面紧跟类的名称 class Circle { //1_访问权限 public: //2_属性 int m 阅读全文
posted @ 2021-07-19 13:47
毋纵年华
阅读(177)
评论(0)
推荐(0)

浙公网安备 33010602011771号