What are the differences between a Class and a Struct?
Given below are the differences between a Class and a Struct:
- Supports Inheritance
- Class is Pass by reference (reference type)
- Members are private by default
- Good for larger complex objects
- Can use waste collector for memory management
Struct :
- Does not support Inheritance
- Struct is Pass by Copy (Value type)
- Members are public by default
- Good for Small isolated models
- Cannot use Garbage collector and hence no Memory management
No comments