//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:"<<<"name:"< <<" weight"<
return 0;
}
C++实现类设计我会提前帮你准备.