Adding interface Tasks
This commit is contained in:
59
Program.cs
Normal file
59
Program.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using DependencyInjections;
|
||||
|
||||
List<IPayment> listOfPayment = new List<IPayment>()
|
||||
{
|
||||
new PayPalPayment(),
|
||||
new CreditCardPayment()
|
||||
};
|
||||
|
||||
foreach (var paymentMethod in listOfPayment)
|
||||
{
|
||||
paymentMethod.ProcessPayment(10);
|
||||
}
|
||||
|
||||
List<IPrintable> listOfPrint = new List<IPrintable>()
|
||||
{
|
||||
new PrintInvoice(),
|
||||
new PrintLetter(),
|
||||
new PrintReport()
|
||||
};
|
||||
|
||||
foreach (var printMethod in listOfPrint)
|
||||
{
|
||||
printMethod.Print();
|
||||
}
|
||||
|
||||
List<IDriveable> driveables = new List<IDriveable>()
|
||||
{
|
||||
new Car("Mercedes"),
|
||||
new Motorcycle("Harley Davidson")
|
||||
};
|
||||
|
||||
foreach (var driveable in driveables)
|
||||
{
|
||||
driveable.Start();
|
||||
}
|
||||
|
||||
List<IMakeSound> makeSounds = new List<IMakeSound>()
|
||||
{
|
||||
new Cat(),
|
||||
new Dog(),
|
||||
new Cow()
|
||||
};
|
||||
|
||||
foreach (var animal in makeSounds)
|
||||
{
|
||||
animal.MakeSound();
|
||||
}
|
||||
|
||||
List<IWeapon> weapons = new List<IWeapon>()
|
||||
{
|
||||
new Staff(),
|
||||
new Bow(),
|
||||
new Sword()
|
||||
};
|
||||
|
||||
foreach (var weapon in weapons)
|
||||
{
|
||||
Console.WriteLine(weapon.Attack());
|
||||
}
|
||||
Reference in New Issue
Block a user