Hard
Empty struct, base or member
On a typical x86-64 target, what does this program print?
main.cpp
#include <iostream>
struct Empty {}; // no members
struct WithEmptyBase : Empty { // (1) Empty inherited as a base class
int x;
};
struct WithEmptyMember { // (2) Empty stored as an ordinary data member
Empty e;
int x;
};
int main() {
std::cout << sizeof(WithEmptyBase) << " " << sizeof(WithEmptyMember) << std::endl;
}62 of 117 in C++