Geeks Talk

Prepare for your Next Interview




Can a structure in C++ have a Constructor and Destructor

This is a discussion on Can a structure in C++ have a Constructor and Destructor within the C and C++ forums, part of the Software Development category; Can a structure in C++ have a constructor and a destructor....


Go Back   Geeks Talk > Software Development > C and C++

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 12-30-2008
Junior Member
 
Join Date: Dec 2008
Location: hyderabad
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
coolsomoo is on a distinguished road
Talking Can a structure in C++ have a Constructor and Destructor

Can a structure in C++ have a constructor and a destructor.
Reply With Quote
The Following User Says Thank You to coolsomoo For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 01-03-2009
Junior Member
 
Join Date: Jan 2009
Location: sudan
Posts: 3
Thanks: 0
Thanked 2 Times in 2 Posts
Wajdy Essam is on a distinguished road
Re: Can a structure in C++ have a Constructor and Destructor

yes , in c++ there is no difference between structure and class except in the protection for data inside them (default access in class is private and public in structure).

good luck,
Reply With Quote
  #3 (permalink)  
Old 02-02-2009
Junior Member
 
Join Date: Jan 2009
Location: pune
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Nisikant is on a distinguished road
Re: Can a structure in C++ have a Constructor and Destructor

yes off course. in C++ the structure has also default constructor and destructor. Because the structure is also a user defined data type but by default the members are public where as by default the members of class in c++ is private. only they are differ from each other on the basis of access specifiers. Nothing else....
Reply With Quote
Reply

  Geeks Talk > Software Development > C and C++


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
constructor & destructor Molugu Natraj C and C++ 6 05-10-2009 08:41 AM
constructor emb.mallik C and C++ 1 03-02-2009 03:50 PM
Constructor kranti_435 Java 1 09-01-2008 07:47 AM
Copy Constructor manoj200724 C and C++ 7 06-15-2008 03:04 PM
why i am getting an error while calling a constructor from another constructor raj_java_j2ee Java 4 07-22-2007 02:39 AM


All times are GMT -4. The time now is 09:14 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved