Jump to content




Recent Status Updates

  • Photo
      30 Sep
    rhossis

    laptop hard disk seated beneath motherboard but with no access panel. 7 hours to replace :(

    Show comments (3)
  • Photo
      19 Sep
    Chall

    I love it when you go to write a help thread, then while writing, you reach an enlightenment, and figure it out yourself.

    Show comments (3)
View All Updates

Developed by TechBiz Xccelerator
Photo
- - - - -

destructors overloading?


  • Please log in to reply
3 replies to this topic

#1 ahmed

ahmed

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 308 posts

Posted 30 March 2009 - 07:03 AM

I wanted to know that why cant we overload a destructor?I have searched on Google but haven't found any reason why it cant be . And another questions is that why is destructor not public,private or protected?
  • 0

#2 MerakSpielman

MerakSpielman

    CC Regular

  • Just Joined
  • PipPipPip
  • 44 posts

Posted 30 March 2009 - 07:51 AM

My understanding is that you can't overload a destructor because you don't call them, and thus don't pass them any variables. They simply happen automatically when you delete an object. They're best used for cleanup work, so you can free up any memory you reserved in the object.

What are you trying to do where you want to pass variables to your destructor?
  • 0

#3 ahmed

ahmed

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 308 posts

Posted 30 March 2009 - 08:40 AM

i just wanted to know the reason I also know that u cant pass them any variables but i wanted the reasons , need more answers :)
  • 0

#4 WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderator
  • 17,154 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 30 March 2009 - 01:29 PM

A destructor is called by the object going out of scope or the delete function being called on it. There is no function call for parameters to be passed through.
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/





Powered by binpress