I am working on an exercise to make sense of C++'s accessibility VS visibility.
The following code doesn't compile obviously, but this is what it ideally must be.
B inherits from A with template parameter Node, and Node is private to B.
template<typename T>
class A {...};
template<typename T>
class B: public A<B<T>::Node> {
private:
struct Node{ int x=42;};
};
My tentative was:
template<typename T>
class A {...};
template<typename T>
class B: public A<B<T>::N> {
private:
struct Node{ int x=42;};
public:
typedef Node N;
};
I get Error: type/value mismatch at argument 1 in template parameter list for ‘template class A’
for both.
I am really lost with this, your help is appreciated.