Created
August 27, 2020 07:44
-
-
Save kurulerdem/c0a551dc279206fc10b6cad0b9e0d674 to your computer and use it in GitHub Desktop.
Interface Kullanımı
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Interfaces | |
{ | |
public interface IEmployee | |
{ | |
void Add(); | |
void ShowSalary(); | |
void ShowTitle(); | |
} | |
class Worker: IEmployee | |
{ | |
void IEmployee.Add() | |
{ | |
Console.WriteLine("Workers Added !"); | |
} | |
void IEmployee.ShowSalary() | |
{ | |
Console.WriteLine("Workers Salary 1300$"); | |
} | |
void IEmployee.ShowTitle() | |
{ | |
Console.WriteLine("Title : Worker"); | |
} | |
} | |
class Manager: IEmployee | |
{ | |
void IEmployee.Add() | |
{ | |
Console.WriteLine("Manager Added !"); | |
} | |
void IEmployee.ShowSalary() | |
{ | |
Console.WriteLine("Managers Salary 4300$"); | |
} | |
void IEmployee.ShowTitle() | |
{ | |
Console.WriteLine("Title : Manager"); | |
} | |
} | |
class ManageEmployee | |
{ | |
public void Add(IEmployee employee) | |
{ | |
employee.Add(); | |
} | |
public void ShowSalary(IEmployee employee) | |
{ | |
employee.ShowSalary(); | |
} | |
public void ShowTitle(IEmployee employee) | |
{ | |
employee.ShowTitle(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Interfaces | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
//Proje Ana Dizini | |
ManageEmployee manageEmployee = new ManageEmployee(); | |
manageEmployee.ShowTitle(new Worker()); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment