(Re) Constructing an object

Discussion in 'Java' started by cpp_novice@yahoo.com, Jul 24, 2006.

  1. Guest

    { 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! ]
     
    , Jul 24, 2006
    #1
    1. Advertising

  2. Simon Guest

    > 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
     
    Simon, Jul 24, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike Wahler
    Replies:
    3
    Views:
    430
    Gavin Deane
    Aug 1, 2003
  2. Marco Wedekind
    Replies:
    11
    Views:
    5,898
    Marco Wedekind
    Apr 26, 2006
  3. Replies:
    1
    Views:
    454
    Daniel Pitts
    Oct 21, 2007
  4. Michael Preminger
    Replies:
    5
    Views:
    420
    Roedy Green
    Mar 18, 2010
  5. Christoph Groth
    Replies:
    8
    Views:
    242
    Carl Banks
    Jun 21, 2010
Loading...

Share This Page