//CStudent.h
calss CStudent
{
public:
long ID;
char* pchName;
float fWeight;
public:
CStudent();//构造
~CStudent(); //析构
};
// CStudent.cpp
#include "iostream"
CStudent();
{
ID = 0;
pchName = NULL;
fWeight = 0.0f;
}
~CStudent(){}; //析构
int main()
{
CStudent stu;
stu.ID = 123;
stu.pchName = "GG";
stu.fWeight = 55.0f;
std::cout
<<"id:"<<stu.ID
<<"name:"<<stu.pchName
<<" weight"<<stu.fWeight;
return 0;
}
温馨提示:答案为网友推荐,仅供参考