(Re) Constructing an object

C

cpp_novice

{ 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! ]
 
S

Simon

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
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top