编写一个Child类,实现Father类的纯虚接口GetName(String)

编写一个Child类,实现Father类的纯虚接口GetName(String),并用sizeof函数查看Child类对象的大小,用Printf打印出来,并与一个空类的大小进行对比。

请直接上代码,谢谢

与一个空类比较大小,这个空类是什么类呢,是下面的意思码?Child类大小为4,nothing类大小为1

#include <string>
#include <iostream>
using namespace std;

class Father
{
public:
	virtual void GetName(string str)=0;
};

class Child : public Father
{
public:
	void GetName(string str) { cout<<str<<endl;}
};

class nothing
{
};


void main()
{
	Child c;
	printf("chile类的大小:%d\n",sizeof(c));
	nothing n;
	printf("nothing类的大小:%d\n",sizeof(n));
}