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.
精彩评论