Cloning is "bad"

M

mike3

Hi.

I saw this discussion thread:

http://stackoverflow.com/questions/...boilerplate-code-for-polymorphic-objects-in-c

It mentions something very similar to what I've got, and the answer
that has the most thumbs up is saying "if you need to clone, the
design is bad", and of course, says nothing about what the _good_
design would be. In my case, what I have is an object called
"LevelGenerator" that has a number of derived types, each of which can
generate a different kind of level and store parameters for the level
generation.

The trick is that there is also an object that holds specifications of
levels in a full level system, and associated with each level
specification is a LevelGenerator. But suppose we need to make many of
these specifiers, each with the same LevelGenerator. It would be
easier to clone the LevelGenerator for each one, so that way, if we
want to delete one of them, we can delete the corresponding
LevelGenerator in that delete without affecting anything else. But
Cloning is BAD!!!!
 

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

Similar Threads


Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top