这样声明string _postfix[3]={"e","es","est","ed"};为什么编译器报错?部分源代码如下,完整的工程文件我上传在 http://free.ys168.com/?ak747 。
#ifndef _enWord_h_
#define _enWord_h_
#include "Iword.h"
#include <fstream>
class enWord:public Iword
{
public:
enWord(string inWord):Iword(inWord){};
~enWord(){};
///返回单词原型
string Prototype(){return _prototype;};
private:
string _prototype;
string _postfix[3]={"e","es","est","ed"};
ifstream irregular("c:\\AUTOEXEC.BAT");
void Cut(string postfix);
void Irregular();
bool Find(){};
};
#endif
注意这是在类中!
楼上的全错了
类成员变量在构造函数里初始化