-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlearnCpp.cpp
More file actions
55 lines (46 loc) · 722 Bytes
/
Copy pathlearnCpp.cpp
File metadata and controls
55 lines (46 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <iostream>
using namespace std;
#pragma pack(push,alignment_1,1)
#pragma pack(push,alignment_2,2)
#pragma pack(push,alignment_4,4)
#pragma pack(push,alignment_8,8)
#pragma pack(push,alignment_16,16)
struct s2 {
char a;
int b;
char c;
int d;
};
struct s3 {
int a;
int b;
char c;
char d;
};
struct A {
bool a;
public:
int b;
private:
char c;
unsigned d;
};
class B {
int b;
public:
unsigned d;
operator double() const{
return (double)b;
}
private:
bool a;
char c;
};
int main(){
cout<< sizeof(bool) << endl;
cout<< sizeof(A) << endl;
cout<< sizeof(B) << endl;
B b;
cout << 1.1 + b << endl;
return 0;
}