Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   (Re) Constructing an object (http://www.velocityreviews.com/forums/t360131-re-constructing-an-object.html)

cpp_novice@yahoo.com 07-24-2006 01:12 PM

(Re) Constructing an object
 
{ Note: cross-posed to comp.lang.java.programmer. -mod/vdv }

Typically, languages do not allow an object to be constructed more
then once. Would allowing (re) construction cause a security failure,
perhaps indirectly, because of assumptions made by existing code bases?

[For instance, it is possible that an object may have file buffers open
and multiple constructor invocations may cause undesired behavior.]


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Simon 07-24-2006 01:30 PM

Re: (Re) Constructing an object
 
> Typically, languages do not allow an object to be constructed more
> then once. Would allowing (re) construction cause a security failure,
> perhaps indirectly, because of assumptions made by existing code bases?


I have never heard of reconstruction and -- as I understand it -- it appears to
be bad style to me, and you have already given reasons. Why would you want to do
this?

For Java collections, you can clear() them, and for other objects (mainly
representing algorithms) like parsers you may init() or reset() them.
Still, it is a question of style whether or not you want objects to be
init()ialised more than once.

Cheers,
Simon

f'up2 cljp


All times are GMT. The time now is 11:26 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.