2016.10.30 类和对象

张凌枫<2016.10.30>【连续第5天总结】

A今日任务
 1.正式开始封装篇
 2.了解类和对象
 3.复习

B.具体任务
 1.知道了类和对象
 2.封装可以做到暴露和隐藏信息
 3.三种访问限定符(public 公共 ; protected 受保护 ; private 私有)
 4.可以选择调用函数
 5.分号!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

附代码:
#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;
 }


明日任务:
 1.复习类和对象感觉很重要
 2.学习初始字符串类型
 3.巩固

博客地址:http://blog.csdn.net/night__day/article/details/52905196
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值