问题 填空题

有如下程序:

  #include

  using namespace std;

  class GrandChild{

  public:

  GrandChild(){ strcpy (name,”Unknown”); }

  const char * getName()const { return name; }

  virtual char * getAddress()const=0;

  private:

  char name[20];

  };

  class GrandSon : public GrandChild{

  public:

  GrandSon{char *name} {}

  Char * getAddress() const { return “Shanghai”; }

  };

  int main(){

  GrandChild *gs=new GrandSon(“Feifei”);

  cout<getName()<<”住在”<getAddress()<  delete gs;

  return 0;

  }

  运行时的输出结果是 【13】

答案

参考答案:Unknown住在Shanghai

填空题
单项选择题