Skip to content

Commit b0abd21

Browse files
author
Wang Jiazi
committed
All the different object has different address.
1 parent 30bbadd commit b0abd21

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

C++/MemoryModel/EmptyObject.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <iostream>
2+
#include <stdio.h>
3+
using namespace std;
4+
5+
class Empty {};
6+
7+
class Derive: public Empty
8+
{
9+
Empty a;
10+
};
11+
12+
int main()
13+
{
14+
cout<<sizeof(Empty)<<endl;
15+
cout<<sizeof(Derive)<<endl;
16+
}

0 commit comments

Comments
 (0)