Previous Topic Next topic Print topic


Interfaces - in COBOL and C# and VB.NET

C# COBOL VB.NET
//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
{
   ...
}
*> Accessibility keywords
*>public
*>private
*>internal
*>protected
*>protected internal
*>static

class-id Competition.

end class.

*> Inheritance
class-id FootballGame inherits type Competition.

end class.


*> Interface definition
interface-id IClock.

end interface.

interface-id ITimer.

end interface.

*> Extending an interface 
interface-id IAlarmClock inherits type IClock.

end interface.


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

end class.
' 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
Previous Topic Next topic Print topic