+ 5
Can a struct have destructors?
Eg - Can this code work? enum{dead=0,alive}; struct Person { private: int state; public: Person(){state=alive;} //This gave no errors though... string name; string address; void kill(){state=dead;} ~Person(){} //This returns an error }
9 odpowiedzi
+ 5
There is a difference b/w C and C++ Structures...
+ 4
@surya kumar
No, structures are there in c++
If not, why does this code work without the destructor?
+ 1
OK wait I I'll be check and then tell u
+ 1
Structure is a collection of variables of different data types under a single name
but we can't use Herr any functions inside class
+ 1
sort inside struct
+ 1
but if u use class u can use constructor destructor and functions inside the class and also access spcifier
+ 1
no diffrece bcoz cpp is developed fromm c so wt it's supported by CPP .and the advance of strict,union,etc is called by as class in cpp
0
c++ doesn't had struct instead of this it has a class
0
at kind of error u got