problem with template inheritance

后端 未结 1 1009
醉梦人生
醉梦人生 2020-12-21 00:11

I\'m trying to understand whay i get an error on this code: (the error is under g++ unix compiler. VS is compiling OK)

template class A {
publ         


        
相关标签:
1条回答
  • 2020-12-21 00:52

    You can also use this->t to access the base class template member.

    In B::get(), the name t is not dependent on the template parameter T, so it is not a dependent name. Base class A<T> is obviously dependent on the template parameter T and is thus a dependent base class. Nondependent names are not looked up in dependent base classes. A detailed description of why this is the case can be found in the C++ FAQ Lite.

    0 讨论(0)
提交回复
热议问题