update dir

This commit is contained in:
light-city
2019-07-21 11:41:27 +08:00
parent 75dcf11c89
commit 9d90e047fd
32 changed files with 1389 additions and 0 deletions

33
sizeof/static.cpp Normal file
View File

@@ -0,0 +1,33 @@
/**
* @file static.cpp
* @brief 静态数据成员
* 静态数据成员被编译器放在程序的一个global data members中它是类的一个数据成员但不影响类的大小。不管这个类产生了多少个实例还是派生了多少新的类静态数据成员只有一个实例。静态数据成员一旦被声明就已经存在。
* @author 光城
* @version v1
* @date 2019-07-21
*/
#include<iostream>
using namespace std;
class A
{
public:
char b;
virtual void fun() {};
static int c;
static int d;
static int f;
};
int main()
{
/**
* @brief 16 字节对齐、静态变量不影响类的大小、vptr指针=8
*/
cout<<sizeof(A)<<endl;
return 0;
}