Dmitro
Dmitro

Reputation: 1970

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?

Upvotes: 0

Views: 121

Answers (2)

sth
sth

Reputation: 229824

You have to add a ; after the class declaration in database.h.

Upvotes: 4

S.C. Madsen
S.C. Madsen

Reputation: 5256

Perhaps database.h contains "unbalanced" brackets or a semi-colon is missing. A classic is missing the required trailing semi-colon on class declarations.

Upvotes: 1

Related Questions