[英]C++ template class
#ifndef ECORE_H
#include "../database.h"
#define ECORE_H
Database *base_provider; // ecore.h: error: expected initializer before ‘*’ token
template <class S, class T>
class ecore { // error: expected class-name before ‘{’ token
public:
~ecore(void){delete base_provider;};
ecore(void){base_provider = new Database();};
};
#endif // ECORE_H
<...> <...>
why i've any get errors in this code? 为什么我在此代码中有任何错误?
You have to add a ;
您必须添加;
after the class declaration in database.h
. 在database.h
的类声明之后。
Perhaps database.h contains "unbalanced" brackets or a semi-colon is missing. 可能database.h包含“不平衡”括号,或者缺少分号。 A classic is missing the required trailing semi-colon on class declarations. 经典在类声明中缺少必需的结尾分号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.