西门子笔试c++编程题目

  写出程序的output

  #i nclude

  class a {

  private:

  int num;

  public:

  a() {

  cout<<"default constructor"<< endl;

  }

  ~a() {

  cout<<"desconstructor"<< endl;

  cout< }

  a(const a &a){

  cout<<"copy constructor"< }

  void operator=(const a &a) {

  cout<<"overload operator"< }

  void setnum(int n) {

  num=n;

  }

  };

  void main()

  {

  a a1;

  a a2(a1);

  a a3=a1;

  a &a4=a1;

  a1.setnum(1);

  a2.setnum(2);

  a3.setnum(3);

  a4.setnum(4);

  }

本文已影响6827
上一篇:东风汽车笔试选择题目 下一篇:传输系统类填空题目

相关文章推荐

|||||