In addition to interfaces, Slice permits the definition of classes. Classes are like structures on steroids, with inheritance and the ability to hold optional data members.
Classes support inheritance and are therefore polymorphic: at run time, you can pass a class instance to an operation as long as the actual class type is derived from the formal parameter type in the operation's signature.
Topics
- Simple Classes
- Class Inheritance
- Class Inheritance Semantics
- Classes as Unions
- Self-Referential Classes
- Classes Versus Structures
- Classes with Operations
- Classes Implementing Interfaces
- Class Inheritance Limitations
- Pass-by-Value Versus Pass-by-Reference
- Passing Interfaces by Value
- Classes with Compact Type IDs
- Value Factories