Interface means a class that has no implementation of its method, but with just declaration. Other hand, abstract class is a class that can have implementation of some method along with some method with just declaration, no implementation.
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
namespace
ConsoleApplication1
{
//interface no implementation only declaration
internal
interface
interfaceName
{
int
GetSalary();
}
public
class
Fresher
: interfaceName
{
public
int
GetSalary()
{
return
10000;
}
}
public
class
ExpSalary
: interfaceName
{
public
int
GetSalary()
{
return
20000;
}
}
internal
class
Program
{
public
static
void
Main(string[]
args)
{
Fresher
fresher = new
Fresher();
int
fresherSal = fresher.GetSalary();
Console.WriteLine(fresherSal.ToString());
ExpSalary
exp = new
ExpSalary();
int
expSal = exp.GetSalary();
Console.WriteLine(expSal.ToString());
Console.ReadLine();
}
}
}