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

Why won't my derived flush work?

Name: Anonymous 2007-03-23 22:09 ID:HKvm8kzy

Hey, I'm trying to create a class that's derived from ostringstream. So, it's like this:

class Message2:public ostringstream {
public:
    Message2 *flush();
};

My flush command does some special stuff, but the problem is it's never called! I've tried setting unitbuf (message << unitbuf; - is that the right way?), but that doesn't improve anything. Ending my streams with endl or flush doesn't call it either. So what's going on here?

Name: Anonymous 2007-03-26 9:33 ID:wTlOzUkI

That's what happen with bad OO models. Why the fuck would you NOT want methods to be virtual? I mean, that's the fucking point! (If you inherit and override from some class and your method is not compatible with what it overrieds, then reimplement the rest of the class or don't fucking write it!)

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