经验交流

3773考试网计算机等级考试经验交流正文

掌握C++

来源:fjzsksw.com 2009-12-17 15:16:50

上面两个函数符合函数重载的条件,但是当调用output(8)时,由于第一个有默认参数,会出现歧义,所以函数重载的时候要注意默认参数这种情况。

  this指针

  上代码:

  #include <iostream.h>

  class point

  {

  public:

  int x;

  int y;

  point()

  {

  x=0;

  y=0;

  }

  point(int a,int b)

  {

  x=a;

  y=b;

  }

  void input(int x,int y) // input(int q,int w)

  {

  x=x; //x=q

  y=y; //y=w

  }

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

触屏版 电脑版
3773考试网 琼ICP备12003406号-1