I came across some weirdness when it seems like a templated class can extend a private nested class.
Given the following private nested class:
class A {
private:
class B {
protected:
void doSomething() {
...
}
};
};
The following does not compile as expected:
class C : public A::B {
public:
C() {
this->doSomething();
}
};
However, gcc, fortunately, seems to accept the following, which compiles without sobbing and actually calls the method:
template<typename T>
class C : public A::B {
public:
C() {
this->doSomething();
}
};
Does anyone know if this is the expected behavior when using templates, or if I found weirdness in gcc. I am in version 4.4.5 (Ubuntu / Linaro 4.4.4-14ubuntu5), so I understand that I'm a little outdated. If this is the expected behavior, I would really appreciate an explanation (or a pointer to an explanation) as this is not what I expected, and I would like to know more about it.
Thanks a lot Matt