Interviews4 answers
4 Answers
Struct is a value type and is stored in stack whereas class is a referenc type and stored in heap. You can implement all the object oriented programming techniques on class but not on struct.
pradeepa nandhaPosted Jul 31, 2006, 9:13 AM EDT
Struct is a value type and is stored in stack whereas class is a referenc type and stored in heap. You can implement all the object oriented programming techniques on class but not on struct.
pradeepa nandhaPosted Jul 31, 2006, 9:12 AM EDT
They have with some of them as follows:
Struct is used for value types whereas class is used for objects.
can not use inherit from struct
I usually use the struct to carry values around in classes...
And if I remember correctly, although struct has constructor, but it is always empty.
There are a few more differences which I do not remember at present.
Struct is used for value types whereas class is used for objects.
can not use inherit from struct
I usually use the struct to carry values around in classes...
And if I remember correctly, although struct has constructor, but it is always empty.
There are a few more differences which I do not remember at present.
farshadPosted Jul 30, 2006, 11:29 PM EDT
A struct is a group of methods and a class is a class of classes.
Bindu Punjab Amar Singh Nahasapeemapetalon GaneshPosted Jul 30, 2006, 10:38 AM EDT