C++ Programming (2nd Edition)
宋春花 / 吕进来Posts & Telecom Press · ChinaAug 2021
Rating 2.9- Word count
- 117K words
- Chapters
- 208
- ISBN
- 9787115452603
Tags
Programming Encapsulation and InheritanceProgramming ParadigmLogical ThinkingObject-OrientedProfessional TextbookCoding PracticeStep-by-Step GuideCase AnalysisKnowledge SystemSelf-Study GuideSummary
This book is written for readers who already have a foundation in C programming and wish to learn C++ object-oriented programming. The book is divided into 9 chapters: Chapters 1 and 2 introduce object-oriented programming methods and the fundamentals of the C++ programming language; Chapters 3 to 6 focus on the three features of object-oriented programming—data encapsulation and hiding, inheritance, and polymorphism—and respectively introduce classes and objects, constructors and destructors, static members, friend classes and friend functions, inheritance and derivation, and polymorphism; Chapters 7 to 9 respectively introduce function templates and class templates, files and streams, and exception handling.Editor's review
Song Chunhua's C++ Programming (2nd Edition) is a clearly positioned and carefully crafted work among the many introductory C++ textbooks. Compared with the first edition, the book's greatest highlight is that it keeps pace with the growing adoption of the C++11 standard: while retaining the core of classic syntax teaching, it organically incorporates modern C++ features such as auto type deduction, range-based for loops, and the preliminary concept of smart pointers. This is not a simple pile-up of knowledge points but reflects the author's instructional design idea of guiding students to make a smooth transition from "traditional C++" to "modern C++."In terms of content organization, the book strictly follows the classic learning path from procedural to object-oriented programming. The solid procedural programming foundation training in the first few chapters fully prepares readers for later understanding why classes and objects are necessary to encapsulate data and behavior. The code examples in the book are short and concise, mostly designed around specific concepts, avoiding the cognitive burden brought by large cases, and are very suitable for beginners to gradually build a knowledge system. The exercise design after each chapter is also ingenious, including both syntax exercises to consolidate the basics and small comprehensive questions that guide thinking, which can effectively test learning outcomes.
As one of the classic textbook series of Posts & Telecom Press, the rigor and accuracy of this book are trustworthy. The author, Song Chunhua, has many years of frontline teaching experience in universities. Her writing is plain, her explanations strive to be thorough, and she can break down complex concepts into easy-to-understand steps. For self-learners, this is a patient and systematic "written mentor"; for university students, it is a reliable supplementary reading or review material for coursework. Although the book does not cover advanced topics such as template metaprogramming in depth, the solid foundation it lays is precisely the necessary prerequisite for subsequently reading classic advanced works such as Effective C++. Overall, this is an excellent introductory work that strikes a good balance between "classic" and "modern," and between "theory" and "practice."
Who it's for
A good fit for
- Undergraduate or vocational college students in computer-related majors, using it as an introductory or companion textbook for C++ programming.
- Programmers with some C language foundation who wish to move to C++ or learn about object-oriented programming.
- Candidates preparing for graduate entrance exams or interviews who need a systematic review of core C++ language concepts.
- Beginners interested in programming who hope to learn C++ through a clearly structured and patiently explained textbook.
Not a good fit for
- Senior developers seeking detailed explanations of the latest standard features such as C++17/20 or advanced techniques such as template metaprogramming and concurrent programming.
- Impatient learners who want to quickly master development in a specific field such as games or graphics and are looking for a large number of hands-on project cases.
Reading tips
- Follow the chapter order and do not skip the procedural programming basics; a solid foundation is key to understanding the object model later.
- Be sure to run every example code in the book and try modifying it to observe changes in the output—this is the most effective way to learn programming.
- When you reach the classes and objects chapters, try rewriting earlier exercises using C++11 features (such as auto) to compare and appreciate the conciseness and safety of modern C++.
About the publisher
Posts & Telecom Press China · Founded in 1953Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.
Contents
- 版权信息
- 内容提要
- 第2版前言
- 第1章 面向对象程序设计概述
- 1.1 面向对象程序设计方法的发展历史
- 1.2 面向过程和面向对象程序设计方法概述
- 1.2.1 面向过程程序设计
- 1.2.2 面向对象程序设计
- 1.3 面向对象程序设计的基本术语
- 1.4 面向对象程序设计的基本特征
- 1.4.1 抽象性
- 1.4.2 封装性
- 1.4.3 继承性
- 1.4.4 多态性
- 1.5 面向对象程序设计语言
- 1.5.1 从C到C++
- 1.5.2 其他的面向对象程序设计语言
- 1.6 基于Visual Studio 2010的C++应用程序的开发
- 小结
- 习题
- 第2章 C++基础
- 2.1 C++程序的组成部分
- 2.2 命名空间
- 2.2.1 什么是命名空间
- 2.2.2 C++中的命名空间定义
- 2.2.3 C++中的命名空间的使用
- 2.2.4 std命名空间
- 2.3 C++数据的输入/输出
- 2.3.1 C++的流
- 2.3.2 cin和流提取运算符>>
- 2.3.3 cout和流插入运算符<<
- 2.4 引用
- 2.5 函数
- 2.5.1 函数原型
- 2.5.2 重载函数
- 2.5.3 带有默认参数的函数
- 2.5.4 内联函数
- 2.5.5 引用参数和返回引用
- 2.6 变量的作用域与可见性
- 2.6.1 作用域
- 2.6.2 可见性
- 2.7 变量的生存期
- 2.7.1 静态生存期
- 2.7.2 动态生存期
- 2.8 const常量
- 2.8.1 常量的定义
- 2.8.2 const和#define
- 2.9 动态内存分配和释放
- 2.9.1 new运算符
- 2.9.2 delete运算符
- 2.10 编译预处理
- 2.10.1 宏定义
- 2.10.2 文件包含
- 2.10.3 条件编译
- 2.11 文件的输入和输出
- 2.11.1 文件的打开和关闭
- 2.11.2 文件的输入和输出
- 小结
- 习题
- 第3章 类和对象
- 3.1 类和对象的概念
- 3.1.1 类的基本概念
- 3.1.2 对象的基本概念
- 3.2 类的定义
- 3.2.1 类的定义格式
- 3.2.2 类的成员
- 3.2.3 类成员访问控制权限
- 3.2.4 成员函数的实现方式
- 3.2.5 将成员函数设置为内联函数
- 3.2.6 成员函数重载
- 3.3 对象的创建与使用
- 3.3.1 对象的定义
- 3.3.2 对象成员的访问
- 3.4 构造函数
- 3.4.1 构造函数的定义和功能
- 3.4.2 默认构造函数
- 3.4.3 无参构造函数
- 3.4.4 构造函数的重载
- 3.4.5 带默认参数的构造函数
- 3.4.6 构造函数与初始化列表
- 3.5 析构函数
- 3.6 构造函数和析构函数的调用顺序
- 3.7 对象数组与对象指针
- 3.7.1 对象数组
- 3.7.2 对象指针
- 3.7.3 this指针
- 3.8 向函数传递对象
- 3.8.1 使用对象作为函数参数
- 3.8.2 使用对象指针作为函数参数
- 3.8.3 使用对象引用作为函数参数
- 3.8.4 三种传递方式比较
- 3.9 对象的赋值和复制
- 3.9.1 对象赋值语句
- 3.9.2 拷贝构造函数
- 3.10 类的组合
- 3.11 程序实例
- 小结
- 习题
- 第4章 类与对象的其他特性
- 4.1 类的静态成员
- 4.1.1 静态数据成员
- 4.1.2 静态数据成员的定义
- 4.1.3 静态数据成员的初始化
- 4.1.4 静态数据成员的使用
- 4.1.5 静态成员函数
- 4.2 友元
- 4.2.1 友元函数
- 4.2.2 友元类
- 4.3 类的作用域和对象的生存期
- 4.3.1 类的作用域
- 4.3.2 对象的生存期
- 4.4 常量类型
- 4.4.1 常量对象
- 4.4.2 常量成员
- 4.4.3 常量引用
- 4.4.4 常量指针与指向常量的指针
- 小结
- 习题
- 第5章 继承与派生
- 5.1 类的继承与派生概念
- 5.2 基类与派生类
- 5.2.1 派生类的声明
- 5.2.2 派生类的生成过程
- 5.2.3 继承方式和派生类的访问权限
- 5.3 派生类的构造函数和析构函数
- 5.3.1 派生类构造函数
- 5.3.2 派生类析构函数的构建
- 5.3.3 派生类构造函数和析构函数的执行顺序
- 5.4 多重继承
- 5.4.1 多重继承的声明
- 5.4.2 多重继承的构造函数和析构函数
- 5.4.3 多重继承中的二义性
- 5.4.4 虚基类
- 5.5 子类型与赋值兼容规则
- 5.5.1 子类型
- 5.5.2 赋值兼容规则
- 5.6 程序实例
- 小结
- 习题
- 第6章 多态性
- 6.1 多态性的概念
- 6.1.1 多态的类型
- 6.1.2 静态关联与动态关联
- 6.2 运算符重载
- 6.2.1 运算符重载的概念
- 6.2.2 运算符重载的方法
- 6.2.3 重载运算符的规则
- 6.2.4 运算符重载为成员函数和友元函数
- 6.2.5 重载双目运算符
- 6.2.6 重载单目运算符
- 6.2.7 重载流插入运算符和流提取运算符
- 6.3 不同类型数据间的转换
- 6.3.1 标准类型数据间的转换
- 6.3.2 用转换构造函数实现类型转换
- 6.3.3 用类型转换函数进行类型转换
- 6.4 虚函数
- 6.4.1 虚函数的定义
- 6.4.2 虚函数的作用
- 6.4.3 对象的存储
- 6.4.4 虚析构函数
- 6.5 纯虚函数与抽象类
- 6.5.1 纯虚函数
- 6.5.2 抽象类
- 小结
- 习题
- 第7章 模板
- 7.1 模板的概念
- 7.2 函数模板与模板函数
- 7.2.1 函数模板的定义和模板函数的生成
- 7.2.2 模板函数显式具体化
- 7.3 类模板与模板类
- 7.3.1 类模板的定义和使用
- 7.3.2 类模板的派生
- 7.3.3 类模板显式具体化
- 7.4 程序实例
- 小结
- 习题
- 第8章 文件和流
- 8.1 C++的输入/输出
- 8.2 标准输入流
- 8.2.1 使用cin进行输入
- 8.2.2 其他istream类方法
- 8.3 标准输出流
- 8.3.1 使用cout进行输出
- 8.3.2 使用cout进行格式化输出
- 8.3.3 其他ostream类方法
- 8.4 文件的输入和输出
- 8.4.1 文件的打开与关闭
- 8.4.2 文本文件的读写操作
- 8.4.3 二进制文件的读写操作
- 8.4.4 使用文件指针成员函数实现随机存取
- 8.5 程序实例
- 小结
- 习题
- 第9章 异常处理
- 9.1 异常处理概述
- 9.1.1 异常、异常处理的概念
- 9.1.2 异常处理的基本思想
- 9.2 异常处理的实现
- 9.2.1 异常处理的语句
- 9.2.2 异常接口声明
- 9.3 构造函数、析构函数与异常处理
- 9.4 异常匹配
- 9.5 标准异常及层次结构
- 9.6 异常处理中需要注意的问题
- 小结
- 习题
- 参考文献
FAQ
Is this book suitable for complete beginners?
This book is a textbook for programming beginners, and the author explains in detail, starting from the first program. However, "complete beginner" here means no programming experience; readers still need basic computer operation skills and logical thinking. If you have never been exposed to programming at all, the first few chapters may require more patience and practice.Is the content of this book outdated? Which C++ version does it cover?
The second edition has been updated to support the C++11 standard. C++11 is the cornerstone of modern C++ and introduced many core features that improve development efficiency and safety. For getting started and mastering the core ideas of C++ such as object orientation and resource management, the content of this book is not outdated, and it lays a solid foundation for learning newer standards.How does this book compare with C++ Primer?
The two have different positioning. C++ Primer is a comprehensive and in-depth reference tutorial with vast content, suitable as a long-term reference book. This book, as a classic domestic university textbook, focuses more on teaching rhythm and progressive knowledge points, is concise in length, and aims to guide readers clearly into the subject and build a core knowledge framework, making it friendlier and less burdensome for beginners.This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.
About the author
宋春花 AuthorSong Chunhua is an author of programming books about whom limited public information is available; two of her works are included in the collection. Based on the available information, her writing centers on teaching the C++ language: one work is C++ Programming (2nd Edition), and the other is the companion volume C++ Programming Exercise Solutions and Practice Tutorial. The former appears to be a textbook that systematically explains C++ fundamentals and programming methods, while the latter focuses on exercise answers and hands-on practice. Together they form a relatively complete learning path. Her books fall under programming design, and the intended readers are mainly beginners and students. Although information is scarce, it is clear that she is experienced in writing textbooks and supplementary teaching materials, with an emphasis on foundational training and practical work, helping readers consolidate grammar and algorithmic thinking through exercises. This division of labor is common in basic computer education and reflects an approach that combines instruction with exercise-based practice.
吕进来 AuthorLü Jinlai is an author active in the field of programming education. Public information about him is limited, and details such as his biography, nationality, and dates of birth and death are not available in the current records. Two of his works are included: C++ Programming (2nd Edition) and A Tutorial on C++ Programming Exercises and Practice, both belonging to the programming design category. Judging from these titles, his writing combines textbook exposition with exercise guidance: on the one hand, he systematically introduces the basic concepts of the C++ language and programming methods; on the other, he helps readers consolidate syntax points and train their problem-solving thinking through exercise analysis. This combination of tutorial and practice suits both classroom teaching and self-study, and can help beginners understand abstract concepts and develop hands-on programming habits. His works are aimed at C++ beginners, with content arranged in a progressive way and a visible emphasis on the practice component among comparable textbooks.