Page 1 of 1

C++

Posted: Wed May 20, 2009 5:11 pm
by Nauk
I had some good laughs reading this, so I thought I'd share it:
http://harmful.cat-v.org/software/c++/

and the (fake) interview with Bjarne Stroustrup:
http://harmful.cat-v.org/software/c++/I ... or_you_all

Enjoy :D

Re: C++

Posted: Wed May 20, 2009 7:08 pm
by KungFooMasta
If you think C++ is not overly complicated, just what is a protected abstract virtual base pure virtual private destructor and when was the last time you needed one?


:lol:

Actually I wish C++ had a lot more functionality, like forcing every derived class to implement a particular function, for example.

Re: C++

Posted: Wed May 20, 2009 7:17 pm
by CABAListic
Heh, yeah, nice list :D

@kungfoo: Could you elaborate on that, more specifically in what way pure virtual functions don't do what you just described? I'm slightly confused :)

Re: C++

Posted: Wed May 20, 2009 8:31 pm
by KungFooMasta
Pure virtual functions only force the first derived class to implement the function. For example, if I have a "toString" function for each class, that returns the name of the class, and I want it to be a hardcoded value, not a string that can be altered or mis-used, I want every class to implement their own "toString" function.

class A;
class B : public A;
class C : public B;

I want the compiler to complain if there isn't the following:

A::toString
B::toString
C::toString

Re: C++

Posted: Wed May 20, 2009 8:55 pm
by CABAListic
Why would a class in the middle of your hierarchy implement such a function? I'd say only concrete classes would need an implementation, but the general recommendation is to have concrete classes at the end of your hierarchy only. Concrete classes in the middle of a hierarchy mix interface and implementation which I think should be avoided.

Re: C++

Posted: Wed May 20, 2009 10:03 pm
by Kencho
Java is, in many ways, C++--
That's the best statement I've ever read :lol:

Re: C++

Posted: Wed May 20, 2009 10:18 pm
by Klaim