#include <iostream>
using namespace std;
class A{
private:
int n;
public:
A();
A(int n);
void show();
};
A::A()
{
cout << "call A()" << this << endl;
n = 100;
}
A::A(int n)
{
cout << "call A(int n)" << this << endl;
this->n = n;
}
void A::show()
{
cout << "n=" << n << endl;
}
int main()
{
A a1;
A a2(200);
a1.show();
a2.show();
return 0;
}
重载
最新推荐文章于 2024-10-29 14:35:26 发布