C#
|
VB.net
|
using System;
interface IGrandpa
{
void iMethod();
}
|
Interface IGrandpa
Sub iMethod()
End Interface
|
abstract class Father : IGrandpa
{
public void iMethod()
{
Console.WriteLine("1. Interface Method");
}
public void fMethod()
{
Console.WriteLine("2. Father Class Method");
}
}
|
MustInherit Class Father
Implements IGrandpa
Public Sub iMethod()
Console.WriteLine("1. Interface Method")
End Sub
Public Sub fMethod()
Console.WriteLine("2. Father Class Method")
End Sub
End Class
|
class Son : Father
{
public Son()
{
Console.WriteLine("3. Son Class Constructor");
}
public void sMethod()
{
Console.WriteLine("4. Sun Class Method");
}
}
|
Class Son
Inherits Father
Public Sub New()
Console.WriteLine("3. Son Class Constructor")
End Sub
Public Sub sMethod()
Console.WriteLine("4. Sun Class Method")
End Sub
End Class
|
class Program
{
public static void Main(string[] args)
{
Son ob = new Son();
ob.iMethod();
ob.fMethod();
ob.sMethod();
Console.ReadLine();
}
}
|
Class Program
Public Shared Sub Main(args As String())
Dim ob As New Son()
ob.iMethod()
ob.fMethod()
ob.sMethod()
Console.ReadLine()
End Sub
End Class
|
Output:
3. Son Class Constructor
1. Interface Method
2. Father Class Method
4. Sun Class Method
|
|