Classes
TypeScript เพิ่ม type safety เข้าไปใน JavaScript classes ทำให้เขียน OOP (Object-Oriented Programming) ได้อย่างปลอดภัย มีการตรวจสอบ type ตั้งแต่ตอน compile และมี features เพิ่มเติมที่ช่วยให้เขียนโค้ดได้สะดวกขึ้น
ข้อดีของ TypeScript Classes
Section titled “ข้อดีของ TypeScript Classes”| Feature | คำอธิบาย |
|---|---|
| Access Modifiers | กำหนดสิทธิ์เข้าถึง public, private, protected |
| Parameter Properties | ลดโค้ดซ้ำซ้อนใน constructor |
| Abstract Classes | สร้าง base classes ที่บังคับให้ subclass implement |
| Type Checking | ตรวจสอบ type ของ properties และ methods ตอน compile |
Class Hierarchy
Section titled “Class Hierarchy”เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google