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.

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 Blogs FAQ Tag Cloud 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

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 & destructor Molugu Natraj C and C++ 6 05-10-2009 09:41 AM
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
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 06:55 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