👀 Классификация типов полиморфизма (дополняется)
1. Ad-hoc polymorphism
- Function and method overloading
- Operator overloading
- Type-class polymorphism (e.g. Haskell type classes, Rust traits)
- Coercion polymorphism
2. Subtype polymorphism
- Class inheritance
- Interface / protocol polymorphism
- Structural (duck typing) polymorphism
3. Parametric polymorphism
- Generic functions
- Generic data structures
4. Dispatch mechanisms
- Dynamic dispatch
- Virtual functions and methods
- Multiple or multimethod dispatch
👉 Примеры и пояснения тут: https://t.me/patterns_javascript
Post #1933
2.44K
- 👍 5
- ❤ 4
- 🔥 1