不允许在数据声明中使用虚拟

时间:2017-03-14 12:17:21

标签: c++

对于函数" getChildern"我不允许在decelartion上使用虚函数。 数据声明不允许虚拟

struct FieldsDataList : public ImplList<S3W::IFields, VarField, S3W::IField>
{
    void                            Clear();
    bool                            Remove(unsigned int id) ;
    virtual VarField*               CreateChild(unsigned int id) const ;
    virtual VarField&               GetInvalidItem() const ;


};


namespace S3W
{
    struct IField : S3W::IListItem
    {
        // double, unsigned int, wchar_t*, IGps*
        enum class Type { NONE = 0, UINT = 1, DOUBLE = 2, STRING = 3 };
        virtual double getDouble() const = 0;
        virtual unsigned int getUint()   const = 0;
        virtual const char*  getString() const = 0;
        virtual const char*  getKey() const = 0;
        virtual Type getType() const = 0;
        virtual ~IField() {}
        virtual FieldsDataList *   getChildern() = 0;
    };
    struct IFields : public S3W::IList<IField>
    {

    };

}

这是完整的错误

2>D:\andre\OSGEarthLib\Schiebel3DWorld/include/IField.h(16): error C2238: unexpected token(s) preceding ';'
2>  MainWindow.cpp
2>D:\andre\OSGEarthLib\Schiebel3DWorld/include/IField.h(16): error C2143: syntax error: missing ';' before '*'
2>D:\andre\OSGEarthLib\Schiebel3DWorld/include/IField.h(16): error C2433: 'S3W::IField::FieldsDataList': 'virtual' not permitted on data declarations
2>D:\andre\OSGEarthLib\Schiebel3DWorld/include/IField.h(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

0 个答案:

没有答案