what are the differences b/w structure and class?
Answer Posted / kiran
Following are the key differences between them :-
1. Structure are value types and classes are reference
types.So structures use
stack and classes use heap.
2. Structures members can not be declared as protected ,
but class members can
be.You can not do inheritance in structures.
3. Structures do not require constructors while classes
require.
4. Objects created from classes are terminated using
Garbage collector.Structures are not destroyed using GC.
| Is This Answer Correct ? | 14 Yes | 0 No |
Post New Answer View All Answers
How does the clr work?
What is boolean conditions in c#?
What is the difference between abstract class and interface in c#?
What are modifiers in c#?
Explain the role of the datareader class in ado.net connections?
Difference between Value type & reference types ? and give the example in .Net?
Explain about CTS?
What is use of a HashTable in .NET?
How many bytes is an int in c#?
Explain manifest & metadata in c#.
Is xml tags are case sensitive?
What is a custom attribute?
What are static and dynamic variables?
Are c# generics the same as c++ templates?
What is difference between singleordefault and firstordefault?