I want the class to create an alias usingfrom the return type of one of its class member functions protected. However, the following fails:
#include <type_traits>
class B
{
protected:
int fun(){return 0;}
};
class D : protected B
{
using T = decltype(std::declval<B>().fun());
};
main() {}
prog.cpp:5:6: error: ‘int B::fun()’ is protected
int fun(){return 0;}
Living example
Why Ddoesn’t have access to the protected method of its base?
source
share