[ create a new paste ] login | about

Link: http://codepad.org/zKTatneG    [ raw code | output | fork ]

C++, pasted on Mar 15:
struct Empty
{
};

struct JustLong
{
long data;
};

struct LongAndEmpty : public JustLong, private Empty
{
};

struct StringAndEmpty: public std::string, private Empty
{
};

int main()
{
cout << "Empty:" << sizeof(Empty) << endl;
cout << "JustLong:" << sizeof(JustLong) << endl;
cout << "String:" << sizeof(std::string) << endl;
cout << "LongAndEmpty:" << sizeof(LongAndEmpty) << endl;
cout << "StringAndEmpty:" << sizeof(StringAndEmpty) << endl;
return 0;
}


Output:
1
2
3
4
5
Empty:1
JustLong:4
String:4
LongAndEmpty:4
StringAndEmpty:4


Create a new paste based on this one


Comments: