上QQ阅读APP看书,第一时间看更新
Classes versus structures
This section compares classes and structures:
- Inheritance enables one class to inherit the characteristics of another
- Type casting enables us to check and interpret the type of a class instance at runtime
- De-initializers enable an instance of a class to free any resources it has assigned
- Reference Counting allows more than one reference to a class instance
- Structures are value types so they are always copied when they are passed around in code
- Structures do not use Reference Counting
- Classes are reference types