12345678910111213141516171819202122232425262728293031323334
#include <iostream> using namespace std; template <typename T> struct base { base(const T& tref): mType(tref) {} protected: T mType; // potentially bad construction style with protected }; template <typename T> struct child: public base<T> { child(const T& tref): base<T>(tref) {} void fx() { cout << "mType == " << base<T>::mType << "." << endl; //cout << "mType == " << mType << "." << endl; // ERROR! } }; int main() { child<int> c(3); c.fx(); }