#include <iostream>
#include <string.h>
using namespace std;
enum Sex{Boy,Gril};
class Person{
public:
string name;
int age;
Sex sex;
public:
Person(){
cout << "Person 的无参构造函数" << endl;
}
Person(string _name){
cout << "Person 的有参构造函数1被调用!" << endl;
name = _name;
}
Person(string _name,int _age,Sex _sex):name(_name),age(_age),sex(_sex){
}
};
void test(){
Person p1;
Person p2 = Person("Json",12,Boy);
Person p3 = Person("a");
Person p4("xi",22,Boy);
cout << p2.name << "\t" << p2.age << "\t" << (Sex)p2.sex << endl;
cout << p3.name<< endl;
}
int main() {
test();
cout << "Hello JSRUN! \n\n - from C++ ." << endl;
return 0;
}