Skip to content
เข้าสู่ระบบ

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
Diagram

เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม

ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด