interface类型

Posted extjs4

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了interface类型相关的知识,希望对你有一定的参考价值。

 

接口可使用的修饰符如下:

InterfaceModifier: one of
    Annotation public protected private
    abstract static strictfp 

 

接口中可声明的一些成员:

InterfaceMemberDeclaration:
ConstantDeclaration
AbstractMethodDeclaration
ClassDeclaration 
InterfaceDeclaration

  

 

The modifier static pertains only to member interfaces (§8.5.1§9.5), not to top level interfaces (§7.6).

The access modifiers protected and private pertain only to member interfaces within a directly enclosing class or enum declaration (§8.5.1).

9.1.1.2. strictfp Interfaces

The effect of the strictfp modifier is to make all float or double expressions within the interface declaration be explicitly FP-strict (§15.4).

This implies that all nested types declared in the interface are implicitly strictfp.

 

It is a compile-time error to refer to a type parameter of an interface I anywhere in the declaration of a field or type member of I.

 

9.1.3. Superinterfaces and Subinterfaces

If an extends clause is provided, then the interface being declared extends each of the other named interfaces and therefore inherits the member types, methods, and constants of each of the other named interfaces.

 

 

Given a (possibly generic) interface declaration for I<F1,...,Fn>(n ≥ 0), the direct superinterfaces of the interface typeI<F1,...,Fn> are the types given in the extends clause of the declaration of I if an extends clause is present.

Let I<F1,...,Fn> (n > 0), be a generic interface declaration. The direct superinterfaces of the parameterized interface type I<T1,...,Tn>, where Ti (1 ≤ i ≤ n) is a type, are all types J<U1θ,...,Uk θ>, where J<U1,...,Uk> is a direct superinterface ofI<F1,...,Fn>, and θ is the substitution [F1:=T1,...,Fn:=Tn].

 

 

9.2. Interface Members

The members of an interface are:

  • Those members declared in the interface.

  • Those members inherited from direct superinterfaces.

  • If an interface has no direct superinterfaces, then the interface implicitly declares a public abstract member method m with signature s, return type r, and throws clause t corresponding to each public instance method m with signature s, return type r, and throws clause t declared in Object, unless a method with the same signature, same return type, and a compatible throws clause is explicitly declared by the interface.

    It is a compile-time error if the interface explicitly declares such a method m in the case where m is declared to be final in Object.

    It follows that is a compile-time error if the interface declares a method with a signature that is override-equivalent (§8.4.2) to a public method of Object, but has a different return type or incompatible throwsclause.

The interface inherits, from the interfaces it extends, all members of those interfaces, except for (a) fields, classes, and interfaces that it hides and (b) methods that it overrides (§9.4.1).

Fields, methods, and member types of an interface type may have the same name, since they are used in different contexts and are disambiguated by different lookup procedures (§6.5). However, this is discouraged as a matter of style.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

以上是关于interface类型的主要内容,如果未能解决你的问题,请参考以下文章

在代码片段中包含类型转换

类型化的反应 - 道具作为 `type` 或 `interface`

[Go] 利用类型断言把interface{}的转换回原类型

Typestript核心——接口interface,类类型,类接口,继承接口

TypeScript 接口(interface)

Xcode自定义代码块