user3423301
user3423301

Reputation: 43

Error : Expected a qualified name after 'typename' C++

Im new to c++ and its developing i have used Templetes there where i use typename and templete i got error which says Expected a qualified name after 'typename'

please find my code below. and I would be very grateful if anyone could point out my stupidity. Thanks

class LapIplImage{
private:
    IplImage *m_img;

public:
    ////////////////////////////////////////////////
    //  construct
    LapIplImage():m_img(NULL){}
    LapIplImage  <typename type>(int width, int height):m_img(0){ Create(width, height); }
    ~LapIplImage(){ Release(); }

//Expected a qualified name after 'typename' 

Upvotes: 2

Views: 4856

Answers (2)

Alexey Andronov
Alexey Andronov

Reputation: 602

You forgot the word "template":
1.

class LapIplImage{
private:
    IplImage* m_img;

public:
    ////////////////////////////////////////////////
    //  construct
    LapIplImage():m_img(nullptr){}
    template <typename type> LapIplImage (int width, int height):m_img(0){ Create(width, height); }
    ~LapIplImage(){ Release();}
};

Upvotes: 3

goInDoor
goInDoor

Reputation: 1

You can not use name that is used as identifier.

So you can try some word that is not used by system .

Like typ or TypE .

Upvotes: -1

Related Questions