update dir

This commit is contained in:
light-city
2019-07-24 22:13:01 +08:00
parent 96ea146c60
commit 16cade9752
14 changed files with 575 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
/**
* @file static_error.cpp
* @brief 静态函数不可以声明为虚函数同时也不能被const和volatile关键字修饰!
* 原因如下:
* static成员函数不属于任何类对象或类实例所以即使给此函数加上virutal也是没有任何意义
* 虚函数依靠vptr和vtable来处理。vptr是一个指针在类的构造函数中创建生成并且只能用this指针来访问它静态成员函数没有this指针所以无法访问vptr。
* @author 光城
* @version v1
* @date 2019-07-24
*/
virtual static void fun() { }
static void fun() const { }