新人菜鸟 求大佬指导 谢谢(跪)
#include "stdafx.h"
#include<iostream>
using namespace std;
int p1;
class People{
public:
string Name;
int Sex;
int Age;
int Stature;
peo(string nx, int sx, int ax, int stax);
People *x;
//成员函数,统称为类的方法,display用于显示
void display() {
cout << "姓名:" << this->GetName() << endl;
cout << "性别:" << this->GetSex() << endl;
cout << "年龄:" << this->GetAge() << endl;
cout << "身高:" << this->GetStature() << endl;
};
//声明成员函数
void Set(string Name, int Sex, int Age,int Stature);
string GetName() {
return this->Name; };
int GetSex() {
return this->Sex;};
int GetAge() {
return this->Age;};
int GetStature() {
return this->Stature; };
};
//默认构造函数
People::peo(string nx, int sx, int ax, int stax)
{
this->Name=Name;
this->Sex=Sex;
this->Age=Age;
this->Stature=Stature;
this->Set(nx,sx,ax,stax);
};
int main(int argc, char* argv[])
{
People p1,p2,p3;
p1.Set("张三",0,20,175);
p2.Set("李四",1,21,180);
p3.Set("王五",0,22,185);
p1.display();
p2.display();
p3.display();
return 0;
}