You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[What is a lambda expression in C++11?](http://stackoverflow.com/questions/7627098/what-is-a-lambda-expression-in-c11)
217
+
[Passing by constant reference in the lambda capture list](http://stackoverflow.com/questions/31179355/passing-by-constant-reference-in-the-lambda-capture-list)
218
+
[Lambda: Why are captured-by-value values const, but capture-by-reference values not?](http://stackoverflow.com/questions/16764153/lambda-why-are-captured-by-value-values-const-but-capture-by-reference-values)
Copy file name to clipboardExpand all lines: C++/Class.md
+149-3
Original file line number
Diff line number
Diff line change
@@ -323,20 +323,157 @@ class D:public B1,public B2;
323
323
324
324
C++ 中,基类必须将它的两种成员函数区分开来:一种是基类希望其派生类进行覆盖的函数,另一种是基类希望派生类直接继承而不要改变的函数。对于前者,基类通常将其定义为`虚函数(virtual)`。当我们使用指针或引用调用虚函数时,该引用将被动态绑定。根据引用或指针所绑定的对象不同,该调用可能执行基类的版本,也可执行某个派生类的版本。(成员函数如果没有被声明为虚函数,则其解析过程发生在编译时而非运行时)
325
325
326
+
## 虚函数
327
+
326
328
基类通过在其成员函数的声明语句之前加上 virtual 关键字使得该函数执行动态绑定,**任何构造函数之外的非静态函数都可以是虚函数**。如果基类把一个函数声明为虚函数,则该函数在派生类中隐式地也是虚函数(**派生类可以不重写虚函数,必须重写纯虚函数**)。[C++ primer P528]
[Should a virtual function essentially have a definition](http://stackoverflow.com/questions/8642124/should-a-virtual-function-essentially-have-a-definition)
524
+
[When to use virtual destructors?](http://stackoverflow.com/questions/461203/when-to-use-virtual-destructors)
525
+
[Should every class have a virtual destructor?](http://stackoverflow.com/questions/353817/should-every-class-have-a-virtual-destructor)
[What are all the common undefined behaviours that a C++ programmer should know about? ](http://stackoverflow.com/questions/367633/what-are-all-the-common-undefined-behaviours-that-a-c-programmer-should-know-a)
134
134
[What are the common undefined/unspecified behavior for C that you run into?](http://stackoverflow.com/questions/98340/what-are-the-common-undefined-unspecified-behavior-for-c-that-you-run-into)
135
-
135
+
[Undefined, unspecified and implementation-defined behavior](http://stackoverflow.com/questions/2397984/undefined-unspecified-and-implementation-defined-behavior)
[What is meant by Resource Acquisition is Initialization (RAII)?](http://stackoverflow.com/questions/2321511/what-is-meant-by-resource-acquisition-is-initialization-raii)
18
+
[RAII and smart pointers in C++](http://stackoverflow.com/questions/395123/raii-and-smart-pointers-in-c)
0 commit comments