Re: dynamic_cast is ugly!
On Mar 9, 4:49 pm, Andy Champ <no....@nospam.com> wrote:
James Kanze wrote:
On 8 mar, 18:51, "Daniel T." <danie...@earthlink.net> wrote:
On Mar 8, 5:08 am, James Kanze <james.ka...@gmail.com> wrote:
Dynamic_cast has its place in good OO design; it just
shouldn't be abused.
Just like goto? :-)
No. Goto never has its place.
Yes it does. I can think of several places where it's really
valuable.
Assembler is impossible without it.
And Fortran IV:-). (My assemblers didn't have goto. We used
something called B or JMP.)
However, I've never written one in C or any of its derived
languages, and I've only seen them in Pascal used as the
equivalent to "throw FatalException".
Yes. The problem isn't the goto itself; the problem is the
program flow structure. One of the cleanest programs I ever saw
was written in Fortran IV, and of course, it used GOTO. But
only to emulate the structures that were missing in the
language.
In C++, of course, we have all of the structures we need (and
even some we don't), so there's really no place for goto.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34