Effective_CPP
Table 

所属分类:Java编程
开发工具:Visual C++
文件大小:23KB
下载次数:4
上传日期:2016-01-18 21:15:29
上 传 者2530210
说明:  虽然多年前在本科课程中学过C++,但之后的几年里,C++主要被我用来进行简单的算法实现或者简单的学术仿真程序的编写,一直没有深入实践过“面向对象的C++”、“泛型的C++”。因此,自己还是一个彻头彻尾的C++初学者。这里从初学者的角度谈谈读了这本书以后对C++的几点新理解新体会。 1,C++追求程序执行的效率,因而牺牲了一些编程开发的便利性。 书中好几个例子提到了这一点。比如,C++类中的方法都是默认non-virtual的。virtual函数会造成额外的开销,空间上要增加Virtual Table和指针,时间上需要通过函数指针查询正确的函数,增加了函数调用时间(条款7)。而Java中,则默认所有函数都是virtual的。又比如,函数的缺省参数值采用了静态绑定的方法,无需运行时动态决定,这就导致了如果在derived class覆盖了base class的缺省参数值,实际上是无法通过base class的指针使用覆盖后的缺省参数值的(条款37)。另外还有垃圾回收机制,很多现代的编程语言都支持,但是C++里却没有强制编译器实现垃圾回收功能。
(Although many years ago in the undergraduate curriculum in middle school over C++, but after a few years, C++ is mainly I used simple algorithm realization or simple academic simulation program is written, there has been no in-depth practice object oriented C++ , a generic C++ . Therefore, he was an out and out C++ beginner. Here a beginner s point of view to read the book after the C++ of several new understanding of the new experience. 1, C++ pursues the efficiency of program execution, and thus sacrifices some of the convenience of programming development. Several examples of this are mentioned in the book. For example, the method in the C++ class is the default non-virtual. Virtual function will cause extra overhead, space to increase the Table Virtual and pointer, the time needed to query the correct function through the function pointer, increasing the function call time (clause 7). And Java, the default all functions are virtual. As another example, the function of the defa)

文件列表:
Effective_C++.docx (25692, 2016-01-18)

近期下载者

相关文件


收藏者