You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
910 B
C#

3 years ago
using System;
namespace InterfaceStudy.Core
{
/// <summary>
/// 基接口
/// 1 接口中的对象都是公开权限的,否则接口无意义:不能使用范围修饰符(public private internal protected
/// 2 接口对象可以是属性 方法 索引 事件 委托等,接口只包含定义不能包含实现,并且不能直接实例化接口。
/// 3 接口对象不能是字段(字段本意为私有,与接口意义相背),
/// 4 不能有构造或析构函数(对象的创建与销毁,应该在实现类所关心的,接口只关心需要实现的功能[属性 方法 索引 事件 委托等]即可)
/// 5 不能有 static 修饰符,即对象不能是静态对象(静态的,本身就是实现;而接口是定义,是契约,只有实现了才有意义)
/// </summary>
public interface IBase
{
3 years ago
int GetNumber() { return 1; }
3 years ago
}
}