Previous Topic Next topic Print topic


Interfaces - in COBOL and C#

Interfaces in Managed COBOL

*> Accessibility keywords
public
private
internal
protected
protected internal
static
 
*> Inheritance
class-id FootballGame inherits type Competition.
  ...
end class.
*> Interface definition
interface-id IAlarmClock.
  ...
end interface.
 
*> Inheriting an interface 
interface-id IAlarmClock inherits type IClock.
  ...
end interface.
 
*> Interface implementation
class-id WristWatch implements type IAlarmClock, type ITimer.
   ...
end class. 

Interfaces in C#

// Accessibility keywords
public
private
internal
protected
protected internal
static
new
 
// Inheritance
class FootballGame : Competition 
{
  ...
}
 
 
// Interface definition
interface IAlarmClock 
{
  ...
}
 
// Extending an interface 
interface IAlarmClock : IClock 
{
  ...
}
 
 
// Interface implementation
class WristWatch : IAlarmClock, ITimer 
{
   ...
}
Previous Topic Next topic Print topic