- 视频直达:C++面向对象高级编程上-基于对象和面向对象
- 课程讲义下载直达:slide
- 源代码直达:code
候捷老师 C++ 系列课程导航:(编号顺序可作为学习顺序参考)
- C++面向对象高级编程(上)-基于对象和面向对象
- C++面向对象高级编程(下)-兼谈对象模型
- C++标准库(STL)与泛型编程
- C++新标准-C++11/14
- C++内存管理
- C++Startup揭秘
这是侯捷老师的所有C++技术课程中最基础最根本的一门课。
C++可说是第一个高度普及的Object-Oriented(面向对象)程序语言。“第一个” 或“最早的”并非重点,重点是经过多年的淬炼和考验C++的影响深入各层面, 拥有众多使用者和极其丰富的资源(书籍、论文、期刊、视频、第三方程序库…)。
作为Object-Oriented(面向对象)技术的主流语言,C++其实还拥有另一支编程 主线:模板与泛型编程(Templates and Generic Programming)。
本课程涵盖上述两条主线:Object-Oriented(面向对象)和泛型编程(Generic Programming)。
由于视频录制时程的因素,本课程分为Part I和Part II. Part I主要讨论OO(面向对象)的基础概念和编程手法。基础最是重要,勿在浮 沙筑高台,着重的是大器与大气。课程首先探讨Class without pointer members 和Class with pointer members两大类型,而后晋升至OOP/OOD,包括classes之 间最重要的三种关系:继承(Inheritance)、复合(Composition)、委托(Delegation)。 Part II继续探讨更多相关主题,并加上低阶的对象模型(Object Model),以及高 阶的Templates(模板)编程。
本课程所谈主题都隶属C++1.0(C++98);至于C++ 2.0(C++11/14)带来的崭新 内容则由侯捷老师的 另一门课程 程涵盖。C++2.0在语言和标准库两方面都带来了很多新 事物,份量足以形成另一门课程。
你将获得整个video课程的完整讲义(也就是video呈现的每一张投影片画面), 和完整的示例程序。你可以(也有必要)在学习过程中随时停下来思考和阅读讲义。
侯捷简介:程序员,软件工程师,台湾工研院副研究员,教授,专栏主笔。曾任 教于中坜元智大学、上海同济大学、南京大学。著有《无责任书评》三卷、《深 入浅出MFC》、《STL源码剖析》…,译有《Effective C++》《More Effective C++》 《C++ Primer》《The C++ Standard Library》…
以下这份不太细致的主题划分,帮助您认识整个课程内容。
Introduction of C++98, TR1, C++11, C++14
Bibliography
Data and Functions, from C to C++
Basic forms of C++ programs
About output
Guard declarations of header files
Layout of headers
Object Based
Class without pointer member
Class declarations
Class template, introductions and overviews
What is 'this'
Inline functions
Access levels
Constructor (ctor)
Const member functions
Parameters : pass by value vs. pass by reference
Return values : return by value vs. return by reference
Friend
Definitions outside class body
Operator overloading, as member function
Return by reference, again
Operator overloading, as non-member function
Temporary objects
Expertise
Code demonstration
class with pointer members
The "Big Three"
Copy Constructor
Copy Assignment Operator
Destructor
Ctor and Dtor, in our String class
"MUST HAVE" in our String class
Copy Constructor
Copy assignment operator
Deal with "self assignment"
Another way to deal with "self assignment" : Copy and Swap
Overloading output operator (<<)
Expertise
Code demonstration
Objects from stack vs. objects from heap
Objects lifetime
new expression : allocate memory and then invoke ctor
delete expression : invoke dtor and then free memory
Anatomy of memory blocks from heap
Allocate an array dynamically
new[] and delete[]
MORE ISSUES :
static
private ctors
cout
Class template
Function template
namespace
Standard Library : Introductions and Overviews
Object Oriented
Composition means "has-a"
Construction : from inside to outside
Destruction : from outside to inside
Delegation means "Composition by reference"
Inheritance means "is-a"
Construction : from inside to outside
Destruction : from outside to inside
Construction and Destruction, when Inheritance+Composition
Inheritance with virtual functions
Virtual functions typical usage 1 : Template Method
Virtual functions typical usage 2 : Polymorphism
Virtual functions inside out : vptr, vtbl, and dynamic binding
Delegation + Inheritance : Observer
Delegation + Inheritance : Composite
Delegation + Inheritance : Prototype
绪论
Conversion function(转换函数)
Non-explicit one-argument constructor
Pointer-like classes,关于智能指针
Pointer-like classes,关于迭代器
Function-like classes,所谓仿函数
标准库中的仿函数的奇特模样
namespace经验谈
class template,类模板
function template,函数模板
member template,成员模板
specialization,模板特化
partial specialization,模板偏特化——个数的偏
partial specialization,模板偏特化——范围的偏
template template parameter,模板模板参数
variadic templates(since C++11)
auto(since C++11)
ranged-base for(since C++11)
reference
Composition(复合)关系下的构造和析构
Inheritance(继承)关系下的构造和析构
Inheritance+Composition关系下的构造和析构
对象模型(Object Model):关于vptr和vtbl
对象模型(Object Model):关于this
对象模型(Object Model):关于Dynamic Binding
谈谈const
关于new,delete
重载 ::operator new,::operator delete
重载 ::operator new[],::operator delete[]
重载 member operator new/delete
重载 member operator new[]/delete[]
示例
重载new(),delete()
示例
basic_string使用new(extra)扩充申请量
-- the end