您当前所在位置:
88好学网范文常识招聘应聘笔试2017年海康威视校园招聘笔试题» 正文

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

[05-18 22:30:27]   来源:http://www.88haoxue.com  笔试   阅读:680

概要:3、用途不同。通常在复制字符串时用strcpy,而需要复制其他类型数据时则一般用memcpy。10、请写出以下程序的输出结果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::Say

2017年海康威视校园招聘笔试题,标签:笔试大全,http://www.88haoxue.com

  3、用途不同。通常在复制字符串时用strcpy,而需要复制其他类型数据时则一般用memcpy。

  10、请写出以下程序的输出结果

  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;

  }

  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()

  I am ~Derived()

  I am ~Base()

  I am ~Base()

  11、阅读以下程序并给出执行结果

  class Bclass

  {

  public:

  Bclass(int i , int j)

  {

  x = i;

  y = j;

  }

  virtual int fun()

  {

  return 0;

  }

  protected:

  int x , y;

  };

  class lclass : public Bclass

  {

  public:

  lclass(int i , int j , int k) : Bclass(i , j)

  {

  z = k;

  }

  int fun()

  {

  return (x+y+z)/3;

  }

  private:

  int z;

  };

  int main(void)

  {

  lclass obj(2,4,10);

  Bclass p1 = obj;

  cout<

  Bclass &p2 = obj;

  cout<

  cout<

  Bclass *p3 = &obj;

  cout

  return 0;

  }

  class Bclass

  {

  public:

  Bclass(int i , int j)

  {

  x = i;

  y = j;

  }

  virtual int fun()

  {

  return 0;

  }

  protected:

  int x , y;

  };

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


Tag:笔试笔试大全招聘应聘 - 笔试
》《2017年海康威视校园招聘笔试题》相关文章