Accessing base member data error when derived class is templated

后端 未结 1 1924
无人共我
无人共我 2021-01-24 09:41

I have the following problem with the curiously recurring template, with a problem when I try to access the data member of CRTP base class.

template

        
相关标签:
1条回答
  • 2021-01-24 09:58

    It doesn't really have to do with CRTP, but rather with the fact that for dependent-base-accessing derived code, you need to qualify things.

    Changing the line to

    std::cout<<this->protectedData<<std::endl;
    

    solved it.

    See accessing a base class member in derived class.

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