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-08 20:54

>>10
I'd argue that what that's not what it's doing. Say we have this simple class.


class A
{
    void Foo() const {}
public:
    void Bar(const A& a)
    {
        a.Foo();
    }
};


That's legal, as it ought to be--an A object can send a private message to any other A object. In my example >>9, why shouldn't a B object be able to send a protected message to any other A object, since a B is an A?

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