59 lines
959 B
C#
59 lines
959 B
C#
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());
|
|
} |