The Main difference of Both is :
Class :
- It was a Reference Type.
- Supports all the features of OOP'S.
- Gets it's memory allocated on managed heap. Because of this garbage collector provides memory management.
- Not faster in access than structure.
- Require a new operator for object creation.
- Default constructor in this was optional.
- Supports both implemenation and interface inheritance.
Structure :
- It was a value type.
- Doesn't support all the features like inheritance.
- Gets it's memory allocated on stack. Because of this garbage collector can't manage the memory .
- Faster in access.
- Doesn't require a new operator for object creation which was only optional.
- Default constructor in this was mandatory.
- Supports only interface inheritance.
No comments:
Post a Comment