Saturday, October 27, 2007

Classes / Interfaces of VB.NET & C#

Classes / Interfaces


In vb.net & c# language Classes / Interfaces are differ. Code of Classes / Interfaces of vb.net & c# language.

____________________________________________________________________

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

-------------------------------------------------------------------------------------------------

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 {
...
}

-------------------------------------------------------------------------------------------------

Note: This code applicable for both desktop and web application.

-------------------------------------------------------------------------------------------------

No comments: