|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Basic use of destructor Hi friends, I am aware about the basic use of constructors. But I don't know about the destructror. What is the use of destructor ?Is use of destructor is similar to the constructor? Please give me solution over this confusion.... |
#2
| |||
| |||
Re: Basic use of destructor Below are some information which I know regarding destructor 1. A the use of destructor is exactly opposite to constructor. 2. The destructor is used to release the constructors. 3. A destructor is a method of a class which executed when the class is deleted. 4. In other word It performs cleanup of the members of the class which need cleanup process , e.g Deallocation of objects referred to pointer within the class. |
#3
| |||
| |||
Re: Basic use of destructor Please go through the following example which shows the use of the destructor : Program code: Quote:
Hope, it will help you |
#4
| |||
| |||
Re: Basic use of destructor Destructors is basically used to deallocate memory allocated by constructor. And also to do other cleanup for a class object and members when the object is deleted. Destructor is called when the object of class passes out of scope OR deleted. Destructor is a member function which has similar name as its class prefixed by a '~' . e.g: Quote:
|
![]() |
|
Tags: destructor, destructor and constructor, use, use of destructor |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dinobot Destructor Pack and Massive Fury Pack DLC for Transformers: Fall of Cybertron | cech | Video Games | 3 | 28-08-2012 12:05 PM |
Problem in LinkedList destructor. | KAIRU26 | Software Development | 5 | 15-02-2010 07:14 PM |
What is the difference between a destructor and a finalizer? | Taylor D | Software Development | 5 | 27-01-2010 10:47 AM |
Destructor in PHP5 | Duck | Software Development | 3 | 18-03-2009 12:01 AM |
Destructor in Java | Anti_Trend | Software Development | 7 | 25-10-2008 03:27 PM |