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
What is difference between string and stringbuffer in c#?
What sort algorithm does c# use?
What is data type c#?
What is inumerable?
What is the function of the not null constraint?
Why we use extension methods in c#?
Why are strings in c# immutable?
What is Co- and Contra-Variance in C#?
What is call back method?
Are c# destructors the same as c++ destructors?
What are the principles of delegation?
What is multithreading? What are the problems that comes with multithreading and how to manage them?
Enlist some of the properties of a thread class?
Why do I get an error (cs1006) when trying to declare a method without specifying a return type?
What are logical operators in c#?