20.1 Interface declarations

原创 2006年05月31日 23:45:00
An interface-declaration is a type-declaration (§16.5) that declares a new
interface type.
interface-declaration:
attributesopt interface-modifiersopt interface identifier interface-baseopt
interface-body ;opt
An interface-declaration consists of an optional set of attributes (§24),
followed by an optional set of interfacemodifiers
(§20.1.1), followed by the keyword interface and an identifier that names
the interface, optionally
followed by an optional interface-base specification (§20.1.2), followed
by a interface-body (§20.1.3), optionally
followed by a semicolon.
20.1.1 Interface modifiers
An interface-declaration may optionally include a sequence of interface
modifiers:
interface-modifiers:
interface-modifier
interface-modifiers interface-modifier
interface-modifier:
new
public
protected
internal
private
It is a compile-time error for the same modifier to appear multiple times
in an interface declaration.
The new modifier is only permitted on nested interfaces. It specifies that
the interface hides an inherited member
by the same name, as described in §17.2.2.
The public, protected, internal, and private modifiers control the
accessibility of the interface.
Depending on the context in which the interface declaration occurs, only
some of these modifiers may be
permitted (§10.5.1).
20.1.2 Base interfaces
An interface can inherit from zero or more interfaces, which are called the
explicit base interfaces of the
interface. When an interface has one or more explicit base interfaces, then
in the declaration of that interface, the
interface identifier is followed by a colon and a comma-separated list of
base interface identifiers.
interface-base:
: interface-type-list
The explicit base interfaces of an interface must be at least as accessible
as the interface itself (§10.5.4). [Note:
For example, it is a compile-time error to specify a private or internal
interface in the interface-base of a
public interface. end note]
C# LANGUAGE SPECIFICATION
280
It is a compile-time error for an interface to directly or indirectly
inherit from itself.
The base interfaces of an interface are the explicit base interfaces and
their base interfaces. In other words, the
set of base interfaces is the complete transitive closure of the explicit
base interfaces, their explicit base
interfaces, and so on. An interface inherits all members of its base
interfaces. [Example: In the example
interface IControl
{
void Paint();
}
interface ITextBox: IControl
{
void SetText(string text);
}
interface IListBox: IControl
{
void SetItems(string[] items);
}
interface IComboBox: ITextBox, IListBox {}
the base interfaces of IComboBox are IControl, ITextBox, and IListBox. In
other words, the IComboBox
interface above inherits members SetText and SetItems as well as Paint. end
example]
A class or struct that implements an interface also implicitly implements
all of the interface?s base interfaces.
20.1.3 Interface body
The interface-body of an interface defines the members of the interface.
interface-body:
{ interface-member-declarationsopt }

整合SiteMesh 之 20.1 调整应用的风格

20.1  调整应用的风格 对于一个企业级的Web应用而言,页面展示需要有统一的风格,比如统一的配色、页头显示企业LOGO、页脚显示版权信息等等。在实际的开发中应该怎么做呢? 统一的配色可以通过引...
  • vipyhd
  • vipyhd
  • 2012年05月06日 19:49
  • 187

Placing const in Declarations by Dan Saks

  • 2009年02月17日 14:03
  • 30KB
  • 下载

【ARM嵌入式Linux系统开发详解 弓雷】【第20章 Linux内核移植】20.1 Linux内核移植要点

转自:http://blog.csdn.net/linuxdianc/article/details/5029282 转此文只是为了留个链接,以后方便查阅。上面这个博客里的内容挺多,虽然只有书中的几...

黑马程序员——20.1,IO流,FileWriter,FileReader

------Java培训、Android培训、iOS培训、.Net培训、期待与您交流! -------                                黑马程序员——20,IO流,Fil...

学习笔记一:命名空间(namespace)之四:using declarations和using directives的区别

(本文主要参考c++ primer第17章2.4节内容。) 由前面内容,我们知道c++引入命名空间(namespace)概念的主要目的是避免命名冲突。但是当我们想要引用命名空间成员时,我们就会体会到...

<Effective Mordern C++>笔记:Item 9:prefer alias declarations to typedefs.

转载自原博:原博 C++11中引入的std::unique_ptr智能指针是个好用的东西,在我们使用unique_ptr的时候往往会写出这样的类型std::uniqeu_ptr,看上去很臃肿,因此大多...
  • cqk0100
  • cqk0100
  • 2017年05月11日 19:43
  • 151

Return type declarations返回类型声明

PHP 7.新增了返回类型声明 http://php.net/manual/en/functions.returning-values.php 在PHP 7.1中新增了返回类型声明为void,以及...

Swift 声明(Declarations)

一条声明(declaration)可以在程序里引入新的名字或者构造。举例来说,可以使用声明来引入函数和方法,变量和常量,或者来定义新的命名好的枚举,结构,类和协议类型。可以使用一条声明来延长一个已经存...

Item5 Prefer auto to explicit type declarations

这个系列的文章来自于Effective Modern C++的读书笔记,我抽取了其中比较重要的,不容易理解的,平常我们开发过程中也不太在意的一些Item进行分析。 写C/C++的程序员都知道定义一个变...

esl-erlang-20.1-1.x86_64

  • 2017年11月30日 10:37
  • 40.95MB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:20.1 Interface declarations
举报原因:
原因补充:

(最多只允许输入30个字)