Use interface keyword to define an interface
using System;
interface Interface1
{
void PrintOut(string s);
}
class MyClass : Interface1
{
public void PrintOut(string s)
{
Console.WriteLine("Calling through: {0}", s);
}
}
class MainClass
{
static void Main()
{
MyClass mc = new MyClass();
mc.PrintOut("object.");
}
}
Output Calling through: object.
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
-
-
-
-
-
-
-
-
|