用户名: 密码: 企业 个人
当前位置:89学习网范文文章招聘应聘笔试2017年海康威视校园招聘笔试题» 正文

2017年海康威视校园招聘笔试题

[05-15 14:50:43]   来源:http://www.89xue.com  笔试   阅读:90
摘要:{printf("I am Base()\n");}virtual ~Base(){printf("I am ~Base()\n");}public:virtual void SayHello(){printf("Hello Base\n");}void SayWorld(){printf("World Base\n");}};class Derived : public Base{public:Derived(){printf("I am Derived()\n");}virtual ~Derived(){pri。
2017年海康威视校园招聘笔试题,标签:笔试范文,http://www.89xue.com

  {

  printf("I am Base()\n");

  }

  virtual ~Base()

  {

  printf("I am ~Base()\n");

  }

  public:

  virtual void SayHello()

  {

  printf("Hello Base\n");

  }

  void SayWorld()

  {

  printf("World Base\n");

  }

  };

  class Derived : public Base

  {

  public:

  Derived()

  {

  printf("I am Derived()\n");

  }

  virtual ~Derived()

  {

  printf("I am ~Derived()\n");

  }

  public:

  void SayHello();

  void SayWorld();

  };

  void Derived::SayHello()

  {

  printf("Hello Derived\n");

  }

  void Derived::SayWorld()

  {

  printf("World Derived\n");

  }

  int main(void)

  {

  Base *b1 = new Base;

  Base *b2 = new Derived;

  Derived *d = new Derived;

  b1->SayHello();

  b1->SayWorld();

  b2->SayHello();

  b2->SayWorld();

  d->SayHello();

  d->SayWorld();

  delete d;

  delete b2;

  delete b1;

  d= NULL;

  b2 = NULL;

  b1 = NULL;

  return 0;

  }

  class Base

  {

  public:

  Base()

  {

  printf("I am Base()\n");

  }

  virtual ~Base()

  {

  printf("I am ~Base()\n");

  }

  public:

  virtual void SayHello()

  {

  printf("Hello Base\n");

  }

  void SayWorld()

  {

  printf("World Base\n");

  }

  };

  class Derived : public Base

  {

  public:

  Derived()

  {

  printf("I am Derived()\n");

  }

  virtual ~Derived()

  {

  printf("I am ~Derived()\n");

  }

  public:

  void SayHello();

  void SayWorld();

  };

  void Derived::SayHello()

  {

  printf("Hello Derived\n");

  }

  void Derived::SayWorld()

  {

  printf("World Derived\n");

  }

  int main(void)

  {

  Base *b1 = new Base;

  Base *b2 = new Derived;

  Derived *d = new Derived;

  b1->SayHello();

  b1->SayWorld();

  b2->SayHello();

  b2->SayWorld();

  d->SayHello();

  d->SayWorld();

  delete d;

  delete b2;

  delete b1;

  d= NULL;

  b2 = NULL;

  b1 = NULL;

  return 0;

  }输出结果:

  I am Base()

  I am Base()

  I am Derived()

  I am Base()

  I am Derived()

  Hello Base

  World Base

  Hello Derived

  World Base

  Hello Derived

  World Derived

  I am ~Derived()

  I am ~Base()

上一页  [1] [2] [3] [4] [5] [6]  下一页


Tag:笔试笔试范文招聘应聘 - 笔试