开发者

Virtual not permitted on data declarations

When trying to declare an abstract class, I don't seem to be able to have templated functions. Why is this, and how do I deal with it? Here is my example header file.

// Foo.h
#include "Bar.h"
#include "Baz.h"
class Foo
{
public:
    Foo();
    virtual Bar<Baz> *getBaz() const = 0;
         //snip
};

Other compiler error from the开发者_运维百科 same line includes

syntax error: missing ';' before '<'


I looks like it does not recognize Bar as a type.

Check your two header files and make sure:

1) That it is defined
2) The include guards are correct and it is not hidden.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜