Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > (Re) Constructing an object

Reply
Thread Tools

(Re) Constructing an object

 
 
cpp_novice@yahoo.com
Guest
Posts: n/a
 
      07-24-2006
{ 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! ]

 
Reply With Quote
 
 
 
 
Simon
Guest
Posts: n/a
 
      07-24-2006
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
constructing an object from another instance of the same class Christoph Groth Python 8 06-21-2010 10:26 AM
Constructing an object from a superclass object Michael Preminger Java 5 03-18-2010 08:22 PM
Constructing a complex object KiteRunner16@gmail.com Java 1 10-21-2007 01:27 AM
Member function redeclaration not allowed when constructing temporary object Marco Wedekind C++ 11 04-26-2006 01:25 PM
Re: constructing an object from bytes rather than a constructor Mike Wahler C++ 3 08-01-2003 01:24 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57