2015年1月26日

成员函数声明与定义

摘要: 成员函数声明与定义在C++中函数有声明部分和定义部分,这样可以更清晰的阅读程序,在一个类的内部声明函数,在类的外部写函数的实现。不然就会报错。#includeclass Humn{private : int height;public : void set_height(int h); int sh... 阅读全文

posted @ 2015-01-26 23:44 aicpcode 阅读(541) 评论(0) 推荐(0) 编辑

public 和private 的区别

摘要: 在C++中成员默认是私有的,私有成员是不能被对象直接访问的,要想解决这个问题就需要,需要把这个成员定义为public 或者是定义一个函数的接口#includeclass Humn{private : int height;public : void set_height(int h){ if(h>... 阅读全文

posted @ 2015-01-26 23:34 aicpcode 阅读(639) 评论(0) 推荐(0) 编辑

C++类的学习笔记

摘要: C++类的学习笔记在C++中类#includeclass humn{public: void get_hight(){ cout<<hight; } void get_weight(); void set_hight(int x){ ... 阅读全文

posted @ 2015-01-26 22:58 aicpcode 阅读(94) 评论(0) 推荐(0) 编辑

导航