Interfaces
Interface เป็นวิธีกำหนด “รูปร่าง” ของ object ว่าต้องมี properties อะไรบ้าง ช่วยให้โค้ดอ่านง่ายและ reuse ได้
ทำไมต้องใช้ Interface
Section titled “ทำไมต้องใช้ Interface”| ข้อดี | คำอธิบาย |
|---|---|
| Type Safety | บังคับให้ object มี properties ครบ |
| Reusability | นำไปใช้ซ้ำได้หลายที่ |
| Extensibility | ขยายได้ด้วย extends |
| Documentation | อ่านโค้ดแล้วรู้ structure ทันที |
Interface & Object
Section titled “Interface & Object”เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google