Effective C++ : 50 specific ways to improve your programs and designs / 2nd ed.

副标题:无

作   者:Scott Meyers著.

分类号:

ISBN:9787508314983

微信扫一扫,移动浏览光盘

简介

  本书汇总了使用C++的50个方针,指导你更好地进行编程和设计,并针对每个方针给出了具体的例子。本书的主要内容有:针对面向对象设计、类设计以及继承的正确用法所给出的方针;对标准C++库的讨论,包括如何使用像string和vector这样的标准模板库来编写优秀的程序;类内部的常量初始化、名字空间和成员模板等;编程高手的督智建议。本书的作者斯科特·迈耶斯是C++方面的公认权威,本书第一版曾创下发行量100000册的成绩,并被翻译成四种语言,其受欢迎程度不言自明。   

目录

preface

acknowledgements

introduction


shifting from c to c++


items 1:prefer const and inline to #define

items 2:prefer iostream to stdio.h

items 3:prefer new and delete to malloc and free

items 4:prefer c++-style comments


memory management


items 5:use the same form in corresponding uses of new and delete

items 6:use delete on pointer members in destructors

items 7:be prepared for out-of-memory conditions

items 8:adhere to convention when writing operator new and operator delete

items 9:avoid hiding the "normal" form of new

items 10:write operator delete if you write operator new


.constructors, destructors, and assignment operators


items 11:declare a copy constructor and an assignment operator for classes with dynamically allocated memory

items 12:prefer initialization to assignment in constructors

items 13:list members in an initialization list in the order in which they are declared

items 14:make destructors virtual in base classes

items 15:have operator return a reference to *this

items 16:assign to all data members in operator

items 17:check for assignment to self in operator


classes and functions: design and declaration


items 18:strive for class interfaces that are complete and minimal

items 19:differentiate among member functions, non-member functions, and friend functions

items 20:avoid data members in the public interface

items 21:use const whenever possible

items 22:prefer pass-by-reference to pass-by-value

items 23:don't try to return a reference when you must return an object

items 24:choose carefully between function overloading and parameter defaulting

items 25:avoid overloading on a pointer and a numerical type

items 26:guard against potential ambiguity

items 27:explicitly disallow use of implicitly generated member functions you don't want

items 28:partition the global namespace


classes and functions: implementation


items 29:avoid returning "handles" to internal data

items 30:avoid member functions that return non-const pointers or references to members less accessible than themselves

items 31:never return a reference to a local object or to a dereferenced pointer initialized by new within the function

items 32:postpone variable definitions as long as possible

items 33:use inlining judiciously

items 34:minimize compilation dependencies between files


inheritance and object-oriented design


items 35:make sure public inheritance models "isa."
items 36:differentiate between inheritance of interface and inheritance of implementation

items 37:never redefine an inherited nonvirtual function

items 38:never redefine an inherited default parameter value

items 39:avoid casts down the inheritance hierarchy

items 40:model "has-a" or "is-implemented-in-terms-of" through layering

items 41:differentiate between inheritance and templates

items 42:use private inheritance judiciously

items 43:use multiple inheritance judiciously

items 44:say what you mean; understand what you're saying


miscellany


items 45:know what functions c++ silently writes and calls

items 46:prefer compile-time and link-time errors to runtime errors

items 47:ensure that non-local static objects are initialized before they're used

items 48:pay attention to compiler warnings

items 49:familiarize yourself with the standard library

items 50:improve your understanding of c++


afterword

index


已确认勘误

次印刷

页码 勘误内容 提交人 修订印次

Effective C++ : 50 specific ways to improve your programs and designs / 2nd ed.
    • 名称
    • 类型
    • 大小

    光盘服务联系方式: 020-38250260    客服QQ:4006604884

    意见反馈

    14:15

    关闭

    云图客服:

    尊敬的用户,您好!您有任何提议或者建议都可以在此提出来,我们会谦虚地接受任何意见。

    或者您是想咨询:

    用户发送的提问,这种方式就需要有位在线客服来回答用户的问题,这种 就属于对话式的,问题是这种提问是否需要用户登录才能提问

    Video Player
    ×
    Audio Player
    ×
    pdf Player
    ×
    Current View

    看过该图书的还喜欢

    some pictures

    解忧杂货店

    东野圭吾 (作者), 李盈春 (译者)

    亲爱的云图用户,
    光盘内的文件都可以直接点击浏览哦

    无需下载,在线查阅资料!

    loading icon