#include<iostream>
using namespace std;
class xiuzhenjie{
public:// 构造函数
xiuzhenjie(int a, int b){
this->alter = a;
this->geschlecht =b;
}
// 构造函数
xiuzhenjie(int a){
this->alter = a;
}
public:
int alter;
int geschlecht;
};
int main()
{
xiuzhenjie tianyuanyu(13,1); // 1
xiuzhenjie* daluotianyu = new xiuzhenjie(14,1);
xiuzhenjie* daxiahuangchao = new xiuzhenjie(13);
int talent1 = 0;
int talent2 = 0;
talent1 = (daluotianyu->alter)*(daluotianyu->geschlecht);
talent2 = (tianyuanyu->alter)*(tianyuanyu->geschlecht);
cout<<"此人的资质:"<< talent1 << endl;
cout<<"此人的资质:"<< talent2 << endl;
return 0;
}
xiuzhenjie tianyuanyu(13,1); // 1
什么样的构造器才能实现这样直接赋值?