#include <iostream.h>
class A
{private:
int x,y;
public:
void fun(int i,int j)
{x=i;y=j;}
void show()
{cout<<x<<" "<<y<<endl;}
};
void main()
{A a1;
a1.fun(2);
a1.show();
}
答案:void fun(int i,int j)调用时有一个参数,形参有两个,可以使第二个带默认值。
[修改]void fun(int i,int j=0)
川公网安备 51010402001278号