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

C++ Member Function Lookup

Name: Anonymous 2010-02-06 12:22

I'm reading `C++ Common Knowledge' to find out more about this fascinating pile of crap. I'm currently in the section `Member Function Lookup' and discovered this gem:

class Foo {
public:
        void x(int) {}
};

class Bar : Foo {
        int x; /* This is fuckin' private. */
};

int main()
{
        Bar bar;
        bar.x(3);
        return 0;
}


I understand what it does and why it does it, but what the fuck was Bjarne thinking when he decided this? If this is object-oriented programming, I'm Ada Lovelace. HIBT?

Name: Anonymous 2010-02-06 13:38

>>4
There are two severe problems with the approach C++ is taking: first of all, Bar's x is private. I, by their very definition, shouldn't need to be concerned about members I can't see. Even if it was public, the right thing would be to realize that `int x' doesn't match the required signature for `bar.x(3)' and continue the search to the base classes.
>>5
OH RLY? funcall my anus.

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