Function that returns derived class?

L

Lew

Richard said:
You can put the main wherever you want, it's only there to demo that the
thing works to the OP, of course you wouldn't put it in that class for real!

If you "of course" wouldn't put it there for real, then you realize, too, that
it's a Bad Thing. I was just pointing that minor point out so that people
wouldn't think it was a Good Thing.

If one shouldn't do something for "real", then you shouldn't do it for
"practice" either. You do what you practice, so practice what you should do.
 
R

Richard Reynolds

Lew said:
If you "of course" wouldn't put it there for real, then you realize, too,
that it's a Bad Thing. I was just pointing that minor point out so that
people wouldn't think it was a Good Thing.

If one shouldn't do something for "real", then you shouldn't do it for
"practice" either. You do what you practice, so practice what you should
do.

It wasn't practice, it was a demonstration of a solution to the OPs
question. The solution, not the usenet demo of it, is what is important.

You completely ignored that this was a perfectly valid solution to the OPs
original question and jumped on this issue.
It would have been fair enough to point out to him that "of course you
shouldn't put the main in there" but I imagine that a lot of people reading
your responses would have thought that you were saying that the solution
itself was flawed when it isn't, as borne out by some of the replies to your
post.

The OP wanted a function that returns a derived class, which I displayed a
way of doing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top