C++编程思想 第五章答案
Chapter 5
5-1
Create a class with public, private, and protected data members and function members. Create an object of this class and see what kind of compiler messages you get when you try to access all the class members.
(Left to the reader)
5-2
Write a struct called Lib that contains three string objects a, b, and c. In main( ) create a Lib object called xand assign to x.a, x.b, and x.c. Print out the values. Now replace a, b, and c with an array of string s[3]. Show that your code in main( ) breaks as a result of the change. Now create a class called Libc, with private string objects a, b, and c, and member functions seta( ), geta( ), setb( ), getb( ), setc( ), and getc( ) to set and get the values. Write main( ) as before. Now change the private string objects a, b, and c to a privatearray of string s[3]. Show that the code in main( ) does not break as a result of the change.
(Left to the reader)
5-3
Create a class and a global friend function that manipulates the private data in the class.
(Left to the reader)
5-4
Write two classes, each of which has a member function that takes a pointer to an object of the other class. Create instances of both objects in main( ) and call the aforementioned member function in each class.
Solution:
//: S05:PointToMeAndYou.cpp
C++编程思想 答案 第九章 其他章节请点击用户名找 thinking in C++ annotated solution guide(charpter 9)_IT/计算机_专业资料。thinking in C++参考答案,第9...
C++编程思想 答案 第十三章 其他章节点击用户名找 thinking in C++ annotated solution guide(charpter 13)_IT/计算机_专业资料。thinking in C++参考答案,第十...
C++编程思想 课后答案第二章 其他章请点击用户名找 thinking in C++ annotated solution guide(charpter 2)_计算机软件及应用_IT/计算机_专业资料。C++编程思想...
C++编程思想 答案 第六章 其他章节请点击用户名找 thinking in C++ annotated solution guide(charpter 6) C++编程思想 课后答案 第六章 其他章节请点击用户...
C++编程思想 答案 第七章 其他章节请点击用户名找 thinking in C++ annotated solution guide(charpter 7) thinking in C++2th 参考答案,第7章 得来不易,所...
使用Sniffer+Pro工具嗅探0(Sniffer+Pro+4.7.5的安装)_IT/计算机_专业资料。软件学院 实验 Sniffer 的环境搭建 课程名称: 实验名称: 实验目的: 网络安全与保密...
CS 201 Schlag January 12 CS 201: Quick reference guide to solving ...c2: General form of solution: Constraints for constants: Solution for ...
A. What B. When C. Which 4. Li Ming ___a film yesterday evening. A. watched 5. What ___the A. is B. watch weather like yesterday? ...
C. 向右平移 π 12 π D. 向左平移 6 ) π 2.函数 y=sin( -2x)的单调增区间是( 4 3π 3π A. [kπ , kπ + ] 8 8 π 3π C. [kπ ...
关于组织咨询单位对安泽指管段进行施工图现场对的通知(2013.5.9)_制度/规范_工作范文_实用文档。 附表 1 安泽指管段需进行施工图现场核对的桥梁工点统计表序 ...
热门文档