简体   繁体   中英

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 .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM