关于类的sizeof的笔试题
今天去笔试居然问这些题目,真是晕倒!!!
假设sizeof(int)=4
1.class Father
{
};
Father f;
sizeof(f)=?
2.class Father
{
int a;
};
Father f;
sizeof(f)=?
3.class Father
{
int a;
struct stru
{
unsigned int c:1;
unsigned int d:1;
}
}
Father f;
sizeof(f)=?
4.class Father
{
int a;
struct stru
{
unsigned int c:1;
unsigned int d:1;
}abc;
}
Father f;
sizeof(f)=?
5.class Father
{
int a;
}
class Child : public Father
{
int b;
}
Child c;
sizeof(c)=?
6.class Father
{
int a;
}
class Child : public Father
{
int a;
}
Child c;
sizeof(c)=?
7.class Father
{
int a;
}
class Child : public Father
{
int b;
}
Child c;
Father&f = c;
sizeof(f)=?