技術上,接口是包含函數型方法的數據結構,客戶代碼透過它調用組件功能。
接口聲明定義新接口類型,格式:
attributes interface-modifiers interface identifier interface-base interface-body;
可用修飾符:new、public、protected、internal、private。同修飾符不重複,new 僅嵌套接口用。四存取修飾符定義訪問權限。
聲明體可含方法、屬性、索引器、事件。例:
interface IControl {
void Paint();
}
(見後續章節)