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
Write the syntax for catching an exception in c#?
What is the default value of datetime in c#?
Int map to which .net types?
How can you sort strings in array that are passed to method as arguments?
How do I do implement a trace and assert?
What is the difference between returning iqueryable vs ienumerable?
Explain streamreader/streamwriter class?
What is the components of window?
What are circular references?
What are different types of classes in c#?
Can you describe iuknown interface in short?
What is boolean method?
What is different between Implicit conversion and Explicit conversion in C#?
What is an assembly loader?
Is namespace necessary in c#?