编程题.这个编程题我怎么连意思都读不懂?有明白的吗?
最佳回答
原问题是:(见《thinking in C++ 2nd》)
33。Repair the problem in Exercise 32 using technique one
shown in this book。
意思是修正练习32中的错误。32题是:
32。In a header file,create a class Mirror that contains two
data members:a pointer to a Mirror object and a bool。
Give it two constructors:the default constructor
initializes the bool to true and the Mirror pointer to zero。
The second constructor takes as an argument a pointer to
a Mirror object,which it assigns to the object’s internal
pointer; it sets the bool to false。Add a member function
test( ):if the object’s pointer is nonzero,it returns the
value of test( ) called through the pointer。If the pointer is
zero,it returns the bool。Now create five cpp files,each
of which includes the Mirror header。The first cpp file
defines a global Mirror object using the default
constructor。The second file declares the object in the first
file as extern,and defines a global Mirror object using
the second constructor,with a pointer to the first object。
Keep doing this until you reach the last file,which will
also contain a global object definition。In that file,main( )
should call the test( ) function and report the result。If the
result is true,find out how to change the linking order
for your linker and change it until the result is false。
我是在想不通你的题目从哪里来的。
32题的要求是:
If the result is true,find out how to change the linking order for your linker and change it until the result is false。
如果结果是真,找出如何为你的链接器改变(这些实现文件的)链接顺序,并且改变它(链接顺序)直到返回false。
这个问题的核心目的就是为了让你理
用extern声明一个变量,可以告诉编译器这个变量在别的地方已经实现过了,编译器在使用它之前应现查找它的实现。
如此以来程序就不会出现不可预知的错误了。
最后告诉你一个有价值的信息:几年前有人写过一个《给C++初学者的50点忠告》的帖子,上面有一条:“请看《thinking in C++》而不要看《C++变成死相》”。这就是说,《C++编程思想》这本书的翻译是超级垃圾的。我看过不少网友批评此书的翻译者太不负责,而由这道题目可见一般。
既然如此,你为什么还看它?
最新回答共有2条回答
-
2026-04-07 23:32:40怕孤单的心情
回复这不是<<C++编程思想>>中的问题!原问题是:(见《thinking in C++ 2nd》)33。Repair the problem in Exercise 32 using technique oneshown in this book。意思是修正练习32中的错误。32题是:32。In a header file,create a class Mirror that contains twodata members:a pointer to a Mirror object and a bool。Give it two constructors:the default constructorinitializes the bool to true and the Mirror pointer to zero。The second constructor takes as an argument a pointer toa Mirror object,which it assigns to the object’s internalpointer; it sets the bool to false。Add a member functiontest( ):if the object’s pointer is nonzero,it returns thevalue of test( ) called through the pointer。If the pointer iszero,it returns the bool。Now create five cpp files,eachof which includes the Mirror header。The first cpp filedefines a global Mirror object using the defaultconstructor。The second file declares the object in the firstfile as extern,and defines a global Mirror object usingthe second constructor,with a pointer to the first object。Keep doing this until you reach the last file,which willalso contain a global object definition。In that file,main( )should call the test( ) function and report the result。If theresult is true,find out how to change the linking orderfor your linker and change it until the result is false。我是在想不通你的题目从哪里来的。32题的要求是:If the result is true,find out how to change the linking order for your linker and change it until the result is false。如果结果是真,找出如何为你的链接器改变(这些实现文件的)链接顺序,并且改变它(链接顺序)直到返回false。这个问题的核心目的就是为了让你理用extern声明一个变量,可以告诉编译器这个变量在别的地方已经实现过了,编译器在使用它之前应现查找它的实现。如此以来程序就不会出现不可预知的错误了。最后告诉你一个有价值的信息:几年前有人写过一个《给C++初学者的50点忠告》的帖子,上面有一条:“请看《thinking in C++》而不要看《C++变成死相》”。这就是说,《C++编程思想》这本书的翻译是超级垃圾的。我看过不少网友批评此书的翻译者太不负责,而由这道题目可见一般。既然如此,你为什么还看它?
热门文章
- 康达学院专转本五年制
- 高考一个考场分ab卷吗
- not only but also用法
- 某物体做自由落体运动,从释放开始计时,则物体在前2s内的平均速度为______m/s,物体下落2m时的速度大小为______m/s.
- 三角函数公式大全表格
- 地理中考必背知识点2022
- 2013-2014学年小学六年级科学上学期期末考试试卷及答案
- 人教版2014-2015学年小学五年级英语第二学期期中教学质量检测试卷及答案
- 【Linux驱动开发】设备树详解(二)设备树语法详解
- 别跟客户扯细节
- 在别的城市买房子能落户吗
- 卖房前要把装修贷还完吗
- 高中政治教学提高教学效果的方法探究
- “互联网+”背景下的初中英语课堂教学改革与创新策略研究
- 2022年终止合同范本
- 租房合同范本范文
- 如何挑选土豆
- 如何挑选土鸡
