Type Compatibility
TypeScript ใช้ Structural Typing (Duck Typing) ไม่ใช่ Nominal Typing - compatible ตาม structure ไม่ใช่ตามชื่อ
Structural vs Nominal Typing
Section titled “Structural vs Nominal Typing”| Feature | Structural (TypeScript) | Nominal (Java/C#) |
|---|---|---|
| Compatibility based on | Structure (shape) | Name/declaration |
| Interface matching | Automatic | Explicit implements |
| Flexibility | High | Low |
เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google