C++编程思想 第五章隐藏实现 习题
2013-07-21 21:53
344 查看
5-1
C++ Code
5-3
5-4
5-6
C++ Code
C++ Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include <iostream> #include <string> #include "myhead.h" #include <cstdio> using namespace std ; class sharp { public: string a; protected: string b; private: string c; public: sharp()//这里必须是public { //this->inital(); this->a="public:"; this->b ="protected:"; this->c ="private:"; } }; int main(void) { sharp check; cout<<check.a; cout<<check.b; check<<check.c; system("pause"); } |
5-4
5-6
C++ Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #include <iostream> using namespace std; class hen { public: class next { public: class egg { public: void dispaly(void) { cout<<"egg"<<endl; } }; void dispaly(void) { cout<<"next"<<endl; } }; void dispaly(void) { cout<<"hen"<<endl; } }; void main(void) { //类的嵌套 hen dage; //二级嵌套 hen::next jidan; //三级嵌套 hen::next::egg fuck; dage.dispaly(); jidan.dispaly(); fuck.dispaly(); system("pause"); } |
相关文章推荐
- C++编程思想笔记--隐藏实现
- C++编程思想--隐藏实现
- JAVA编程思想学习 --- 第五章 (隐藏实施过程)
- 《C++编程思想》第三章 隐藏实现 (原书代码+习题+解答)
- 下推栈实现(c++编程思想 p136)
- 第五章:隐藏实现 Hiding the Implementation
- JAVA基础学习篇----《thinking in java》第五章:隐藏实现
- java编程思想3感悟(4)---被隐藏的具体实现
- 【学习笔记】Thinking in java (第三版)第五章 隐藏实现(Hiding the implementation)
- 第五章 隐藏实现细目(9)
- 《机器学习》+周志华+第五章习题+5.5实现标准BP算法和累积BP算法
- 第五章 隐藏具体实现
- 编程珠玑第五章习题五——C++实现二分搜索时进行错误检测
- 手动实现类似容器---c++编程思想
- java编程思想概括(第五章)---隐藏具体实现
- C++中的名字隐藏之<C++编程思想>
- 用一维数组实现栈(C++编程思想 p120)
- C++编程思想 第二章习题2_2
- C++编程思想学习笔记---第五章 隐藏实现
- Thinking in Java第三版读书笔记-第五章:隐藏实现