Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

constructor & destructor

This is a discussion on constructor & destructor within the C and C++ forums, part of the Software Development category; What is common & difference in specifying constructor and destructor?...

Go Back   Geeks Talk > Software Development > C and C++
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 10-20-2008
Junior Member
 
Join Date: Oct 2008
Location: Hydereabad
Posts: 1
Thanks: 0
Thanked 2 Times in 1 Post
Molugu Natraj is on a distinguished road
constructor & destructor

What is common & difference in specifying constructor and destructor?
Reply With Quote
The Following 2 Users Say Thank You to Molugu Natraj For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 03-16-2009
Junior Member
 
Join Date: Aug 2008
Location: hyd
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
hema.prasanna.deepthi is on a distinguished road
Re: constructor & destructor

tilde character in front of destructor .
Reply With Quote
  #3 (permalink)  
Old 03-31-2009
Junior Member
 
Join Date: Mar 2009
Location: Bangalore
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
puneet83 is on a distinguished road
Re: constructor & destructor

class name is common whereas a tilde sign (~) is a the difference between the two
Reply With Quote
The Following User Says Thank You to puneet83 For This Useful Post:
  #4 (permalink)  
Old 04-04-2009
Junior Member
 
Join Date: Apr 2009
Location: erode
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
akchaya is on a distinguished road
Re: constructor & destructor

Quote:
Originally Posted by Molugu Natraj View Post
What is common & difference in specifying constructor and destructor?
tilde(~) is the common difference between two

constructor not contain(~) operator
Reply With Quote
  #5 (permalink)  
Old 04-06-2009
Junior Member
 
Join Date: Apr 2009
Location: Kolhapur
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
parvez_btech is on a distinguished road
Re: constructor & destructor

Quote:
Originally Posted by Molugu Natraj View Post
What is common & difference in specifying constructor and destructor?
Constu. is a method (function) which is exicuted at the time of creating boject.
destuc. is a method exicuted after distroying object.
Reply With Quote
  #6 (permalink)  
Old 05-10-2009
Junior Member
 
Join Date: May 2009
Location: INDIA
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
anushandilya123 is on a distinguished road
Re: constructor & destructor

constructor used for memory allocatio ntoo..while destructor for deallocating it...
Reply With Quote
  #7 (permalink)  
Old 05-10-2009
Junior Member
 
Join Date: Mar 2009
Posts: 3
Thanks: 0
Thanked 1 Time in 1 Post
diwanshuster is on a distinguished road
Re: constructor & destructor

when object is created constructor for the class is called that helps in initialising the data members of the class. To which we also sometimes wrongly refer to as 'memory allocation'.

Similarly Destructor is called once the use of the object of the class is finished. So it helps to free the memory occupied by the object, to the system heap.
Reply With Quote
The Following User Says Thank You to diwanshuster For This Useful Post:
Reply

  Geeks Talk > Software Development > C and C++

Thread Tools
Display Modes

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
constructor emb.mallik C and C++ 1 03-02-2009 04:50 PM
Constructor kranti_435 Java 1 09-01-2008 08:47 AM
Copy Constructor manoj200724 C and C++ 7 06-15-2008 04:04 PM
Constructor and init() pramod.kuber Java 3 11-04-2007 02:42 AM
why i am getting an error while calling a constructor from another constructor raj_java_j2ee Java 4 07-22-2007 03:39 AM


All times are GMT -4. The time now is 09:26 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved