1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to call constructor and destructor explicitly?

Discussion in 'Programming' started by Harris21, Aug 29, 2010.

  1. #1
    how to call constructor and destructor explicitly?
     
    Harris21, Aug 29, 2010 IP
  2. Dixanta Shrestha

    Dixanta Shrestha Active Member

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    56
    #2
    in what programming language?
     
    Dixanta Shrestha, Aug 29, 2010 IP
  3. bojomojo

    bojomojo Peon

    Messages:
    921
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you can not call a constructor, its called with the function calling nothing else. same for the destructor
     
    bojomojo, Aug 29, 2010 IP
  4. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #4
    Constructor gets called upon instantiation of the object while destructor gets called at the end of scope in which the object was created
     
    Rainulf, Aug 30, 2010 IP
  5. Harris21

    Harris21 Peon

    Messages:
    28
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i am asking for C++?
     
    Harris21, Aug 30, 2010 IP
  6. hhelen

    hhelen Member

    Messages:
    352
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    33
    #6
    Sorry, I would suggest you look up a tutorial on C++ as a full explanation is beyond the scope of this thread or forum.
     
    hhelen, Aug 31, 2010 IP
  7. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #7
    Make default constructor and destructor private and have your own create and destroy function , call the destructor and constructor from those functions.
     
    it career, Aug 31, 2010 IP