23 April 2011

Class Vs structures

1. Classes are reference types and structs are value types.
    means Class will be allocated on a heap and structs will be allocated on the stack.

2. You cannot have instance Field initializers in structs.
    means we cant have variables as structs instance members.
3. Classes can have explicit parameter less constructors. But struts cannot have.
4. Classes must be instantiated using the new operator. But struts can be without.
5. Class support Polymorphism and inheritance but struct wont.
6. Protected and ProtectedInternal is not supported in struct.
8. A class is permitted to declare a destructor. But a struct is not
7. classes are used for complex and large set data. structs are for simple data structures.

No comments:

Post a Comment

Your comments, Feedbacks and Suggestions are very much valuable to me :)

Things are upgraded

My Dear readers, I am really thankful for being supportive all these years. This site was the first blog site I ever created in my life...