张凌枫<2016.10.30>【连续第5天总结】
A今日任务
1.正式开始封装篇
2.了解类和对象
3.复习
1.正式开始封装篇
2.了解类和对象
3.复习
B.具体任务
1.知道了类和对象
2.封装可以做到暴露和隐藏信息
3.三种访问限定符(public 公共 ; protected 受保护 ; private 私有)
4.可以选择调用函数
5.分号!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1.知道了类和对象
2.封装可以做到暴露和隐藏信息
3.三种访问限定符(public 公共 ; protected 受保护 ; private 私有)
4.可以选择调用函数
5.分号!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
附代码:
#include <iostream>
#include <stdlib.h>
using namespace std;
#include <iostream>
#include <stdlib.h>
using namespace std;
class zuobiao
{
public:
int x ;
int y ;
void printx()
{
cout<<x<<endl;
}
void printy()
{
cout<<y<<endl;
}
};
int main(void)
{
zuobiao coor;
coor.x =100;
coor.y = 20;
coor.printx();
coor.printy();
zuobiao *p = new zuobiao();
if(NULL == p)
{
//failed
return 0;
}
p->x = 10;
p->y = 200;
p->printx();
p->printy();
delete p;
p = NULL;
system("pause");
return 0;
}
{
public:
int x ;
int y ;
void printx()
{
cout<<x<<endl;
}
void printy()
{
cout<<y<<endl;
}
};
int main(void)
{
zuobiao coor;
coor.x =100;
coor.y = 20;
coor.printx();
coor.printy();
zuobiao *p = new zuobiao();
if(NULL == p)
{
//failed
return 0;
}
p->x = 10;
p->y = 200;
p->printx();
p->printy();
delete p;
p = NULL;
system("pause");
return 0;
}
明日任务:
1.复习类和对象感觉很重要
2.学习初始字符串类型
3.巩固
博客地址:http://blog.csdn.net/night__day/article/details/52905196