爱立信常考的笔试真题(2)

招聘笔试题2018-11-22李天扬老师

  virtual void func(int num){cout << "base: " << num << endl;}

  };

  class derived : public base

  {

  public:

  void func(const char* str){cout << "derived: " << str << endl;}

  void func(int num){cout << "derived: " << num << endl;}

  void func(){cout << "the function is in derived!" << endl;}

  };

  int main()

  {

  base *pb;

  derived objd;

  pb = objd;

  pb->func(11);

  pb->func("hello");

  // pb->func();

  getchar();

  return 0;

  }

相关推荐

猜你喜欢

大家正在看

换一换