初始化成员变量-数组

static变量
class Robot{
staticint posLShd[5];//..
};

intRobot::posLShd[5]={250,330,512,600,680};// in .cpp file

C++yuyan zai 数组作为成员变量初始zeyiu zuoe bha 
classRobot{

private:

int posLShd[5];

staticint posLArm[5];// .
.public:Robot():
   posLShd{250,330,512,600,680}// only C++0x                                    {}
~Robot();

};

猜你喜欢

转载自yangbinfx.iteye.com/blog/1991179