摘要: #include using namespace std;struct date{int day;int month;int year;int yeardays;};void days(struct date *pd);void main(){struct date ymd;cout > ymd.year >> ymd.month >> ymd.day;days(&ymd);cout yeardays = pd -> day;Ip = pd->year%4==0&&pd||pd->year%100!=0||pd->y 阅读全文
posted @ 2013-10-07 15:38 Blackfog 阅读(201) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;class Outer{public: class Inner { public: void Fun(); ///*{ // cout << "Inner::Fun..." << endl; //}*/ };public: Inner obj_; void Fun() { cout << "Outer::Fun..." << endl; obj_.Fun(); }};void Outer::Inner::Fun(){ cout << &q 阅读全文
posted @ 2013-10-04 22:30 Blackfog 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 类#pragmaonce防止头文件重复包含等价于#ifndef#define#endif类有两个要素1,.数据成员2,.成员函数。数据成员表达了类的属性状态。成员函数表达了类的行为。Public.Private.Protected;Pritected与private类似。其差别表现在继承与派生时对派生类的影响不同;内联函数提高效率编译的时候将代码直接嵌入到调用的地方,从而减少函数调用的开销体积增大以空间换时间;短小内联函数只是给编译器一个申请提示,如果函数中用switchfor将不会编译成员函数也可以做重载要求是相同的作用域;Class与struct的区别Struct也是一种类,也可以有成员函 阅读全文
posted @ 2013-10-04 15:25 Blackfog 阅读(112) 评论(0) 推荐(0) 编辑