#include<iostream>
#include<string>
using namespace std;
class cla
{
public:
cla()
{
cout << "无参构造" << endl;
}
cla(string s)
{
cout << "有参构造string" << endl;
}
cla(int i)
{
cout << "有参构造int" << endl;
}
~cla()
{
cout << "析构方法" << endl;
}
};
int main()
{
//隐式传参 === cla a = cla(10);
string s = "a";
cla a = 10;
cla b = s;
//显式传参
cla c = cla(10);
cla d = cla("a");
//匿名对象,一次对象只调用一次
cla(10);
}