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
Why is main static in c#?
What are access modifiers used for?
Why do we parse in c#?
In how many ways you can overload a method?
Define c# i/o classes? List the commonly used classes?
What is private void in c#?
How do I start a program in c#?
What does void do in c#?
What is an enumerator c#?
Can you pass value types by reference to a method?
How we can create an array with non-default values?
Who is a accessibility modifier “protected internal†available to ?
What is global namespace in c#?
What does dbml mean in texting?
What does console readline do?