|
|
Hi Warp, you recently wrote in povray.general:
> It may be a standard way in Java.
I wouldn't know, I've never written any. I've been doing C++ the last
7 years.
> Making a module which allocates a resource, returns a handle to this
> resource outside and hopes that someone else will hopefully free it somewhere,
> is a *really* bad module design (and OO design).
Generally, I agree, but not in this case. And you failed to answer my
question. How do create a copy of an object to which you have a base
class pointer. As Thorsten said, since there are no virtual
constructors, you can't do it any other way. The design of the module
has nothing to do with this. The way the return value (the new object)
is handled is part of the module design. To make sure there are no
leaks.
> The whole class hierarchy should be designed so that this kind of copying
> is not needed (ie. not in this way).
Very funny. There is no amount of design that can avoid this.
> Making efforts for a good design now can save you a lot of trouble later.
Now that I agree with :-)
- Lutz
email : lut### [at] stmuccom
Web : http://www.stmuc.com/moray
Post a reply to this message
|
|