如何使用模板類基類中的結構體?


using namespace std;spa

template<class T>class

class Areturn

{struct

    public:

    typedef struct

    {

        int a;

    }W;

};


template<class T>

class B:public A<T>

{

    public:

    B(){

       typename B<T>::W a;//加上typename關鍵字


    }


};

int main()

{

    B<int> a;

    B<int>::W b;

    b.a=10;

    return 0;

}

相關文章
相關標籤/搜索