C#
|
VB.net
|
using System;
class BC
{
public void MethodBC()
{
Console.WriteLine("Any class can Inherit from me");
}
}
|
Class BC
Public Sub MethodBC()
Console.WriteLine("Any class can Inherit from me")
End Sub
End Class
|
sealed class DC : BC
{
public void MethodDC()
{
Console.WriteLine("No class can Inherit from me");
}
}
|
NotInheritable Class DC
Inherits BC
Public Sub MethodDC()
Console.WriteLine("No class can Inherit from me")
End Sub
End Class
|
class Program
{
private static void Main(string[] args)
{
DC ob = new DC();
ob.MethodBC();
ob.MethodDC();
Console.ReadKey();
}
}
|
Class Program
Private Shared Sub Main(args As String())
Dim ob As New DC()
ob.MethodBC()
ob.MethodDC()
Console.ReadKey()
End Sub
End Class
|
Output:
Any class can Inherit from me
No class can Inherit from me
|