Prepare for your Next Interview
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....
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
Can a structure in C++ have a constructor and a destructor.
|
| The Following User Says Thank You to coolsomoo For This Useful Post: | ||
| Sponsored Links |
|
|||
|
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, |
|
|||
|
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....
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| 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 |