インターフェイス

このヘルプでは、COBOL、C#、VB.NET でのインターフェイスの使い方について説明します。

COBOL のインターフェイス

*> Accessibility keywords
public
private
internal
protected
protected internal
static

*> Inheritance
class-id. FootballGame inherits type Competition.
  ...
end class FootballGame.


*> Interface definition
interface-id. IAlarmClock.
  ...
end interface IAlarmClock.

*> Extending an interface
interface-id IAlarmClock extends type IClock.
  ...
end interface IAlarmClock.


*> Interface implementation
class-id. WristWatch implements type IAlarmClock, type ITimer.
   ...
end class WristWatch.

C# のインターフェイス

//Accessibility keywords
public
private
internal
protected
protected internal
static

// Inheritance
class FootballGame : Competition
{
  ...
}


// Interface definition
interface IAlarmClock
{
  ...
}

// Extending an interface
interface IAlarmClock : IClock
{
  ...
}


// Interface implementation
class WristWatch : IAlarmClock, ITimer
{
   ...
}

VB.NET のインターフェイス

' Accessibility keywords
Public
Private
Friend
Protected
Protected Friend
Shared

' Inheritance
Class FootballGame
  Inherits Competition
  ...
End Class

' Interface definition
Interface IAlarmClock
  ...
End Interface

' Extending an interface
Interface IAlarmClock
  Inherits IClock
  ...
End Interface

' Interface implementation
Class WristWatch
  Implements IAlarmClock, ITimer
   ...
End Class

これらの例の一部は、ハーディング大学コンピューター サイエンス学部の Frank McCown 博士が作成したもので、クリエイティブ コモンズ ライセンスに基づいて使用が許可されています。