![]() |
#2
sunkaidong2008-03-27 20:47
|
我是初学C++,是为了完成作业而学,下面有这样一段使用静态成员函数小程序,各位大侠帮忙找出错误,并告如何修改,谢谢了:
#include<iostream.h>
#include<string.h>
class person{
public:
char m_strName[20];
long m_ID;
public:
person(char*strName,long ID){strcpy(m_strName,strName);m_ID=ID; }
static long GetID()
{return m_ID; }
};
void main()
{
person person1("LiuJun",1101640524);
cout<<"ID="<<person::GetID()<<'\n';
}