Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Sepplesfags, help!

Name: Anonymous 2008-12-08 18:34


template <class T>
class A
{
public:
    typedef T Foo;
};

template <class T>
class B
{
    A<T>::Foo foo;
};

int main()
{
    B<int> b;
    return 0;
}



test.cpp:11: error: type ‘A<T>’ is not derived from type ‘B<T>’
test.cpp:11: error: expected ‘;’ before ‘foo’


What the FUCK?

Name: Anonymous 2008-12-10 0:54

>>11
Inheritance does not mean access.  When you derived B from A you inherited the Foo function, so every B has its own Foo to call.  This does not mean that nonlocal A's have to give access to their protected methods in B methods now.

Whereas your other example has nothing to do with this at all. Foo is used within one of the other class methods. Nothing wrong with that.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List