Memory layout differences in structs
问题 I have the following structure in C++ struct A { int a; double b; float c; } Is there a difference in memory layout between this struct and one with a function added to it? struct B { int a; double b; float c; void foo(); } B::foo() { //do stuff } 回答1: The C++ standard guarantees that memory layouts of a C struct and a C++ class (or struct -- same thing) will be identical, provided that the C++ class/struct fits the criteria of being POD ("Plain Old Data"). So what does POD mean? A class or