class question 1
一个关于静态成员函数的程序,有点问题,请帮忙看看.
#include<iostream>
using namespace std;
class R
{
public:
// R():number(0){}
void display()
{
cout<<"Number:\t"<<number<<endl;
}
static void rework(int);
private:
static int number;
};
void R::rework(int t)
{
number+=t;
}
int main()
{
R temp;
temp.rework(5);
temp.display();
system("pause");
return 0;
}
问题点数:20、回复次数:3Top
1 楼junguo(junguo)回复于 2006-03-03 18:57:50 得分 20
class R
{
public:
// R():number(0){}
void display()
{
cout<<"Number:\t"<<number<<endl;
}
static void rework(int);
private:
static int number;
};
void R::rework(int t)
{
number+=t;
}
int R::number = 0;Top
2 楼junguo(junguo)回复于 2006-03-03 18:58:13 得分 0
按以上的方式初始化一下!Top
3 楼wzjall(风)回复于 2006-03-03 21:55:04 得分 0
已经解决了,好!Top
相关问题
- an SCJP question,the graphics class has a coordinate system with an origin ?
- class class
- Write a "Send To" menu class in c# ~~this question is sent with a high importance ~~wait online~~
- Base Class And Derived Class
- public class a和class a
- friend class
- *.class --->*.java !!!!
- RUNTIME_CLASS?
- Class Library ?????
- class xxx




