- Expert Angular
- Mathieu Nayrolles Rajesh Gunasundaram Sridhar Rao
- 98字
- 2021-07-15 17:05:31
Class type interfaces
Class type interfaces define the contract for classes. A class that implements an interface should meet the requirement of the interface:
interface CustomerInterface { id: number; firstName: string; lastName: string; addCustomer(firstName: string, lastName: string); getCustomer(id: number): Customer; } class Customer implements CustomerInterface { id: number; firstName: string; lastName: string; constructor() { } addCustomer(firstName: string, lastName: string) { // code to add customer } getCustomer(id: number): Customer { return this; } }
The class type interface only deals with public members of the class. So, it is not possible to add private members to the interface.
推薦閱讀
- Learn Blockchain Programming with JavaScript
- Machine Learning with R Cookbook(Second Edition)
- Twilio Best Practices
- 零基礎學Java(第4版)
- OpenShift在企業中的實踐:PaaS DevOps微服務(第2版)
- 精通Python自然語言處理
- 深入淺出Serverless:技術原理與應用實踐
- 自然語言處理Python進階
- Spring+Spring MVC+MyBatis整合開發實戰
- Python圖形化編程(微課版)
- Mastering Akka
- IBM Cognos TM1 Developer's Certification guide
- Python Digital Forensics Cookbook
- Greenplum構建實時數據倉庫實踐
- Visual Basic語言程序設計基礎(第3版)