Update Lesson 4 Task 2

This commit is contained in:
Stanislav Mykhailenko 2023-04-10 18:31:36 +03:00
parent 3f3a735aa7
commit 9e80815935
GPG key ID: 1E95E66A9C9D6A36
6 changed files with 34 additions and 12 deletions

View file

@ -4,11 +4,13 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Open_Closed
using Open_Closed.Interfaces;
namespace Open_Closed.Classes
{
public class FireMagic : Magic
public class FireMagic : IMagic
{
public override void CountYourMagic()
public void CountYourMagic()
{
Console.WriteLine("Wow, your magic is fire magic!");
}

View file

@ -4,11 +4,13 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Open_Closed
using Open_Closed.Interfaces;
namespace Open_Closed.Classes
{
public class Magic
public class UnknownMagic : IMagic
{
public virtual void CountYourMagic()
public void CountYourMagic()
{
Console.WriteLine("I understand you...");
}

View file

@ -4,11 +4,13 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Open_Closed
using Open_Closed.Interfaces;
namespace Open_Closed.Classes
{
public class WaterMagic : Magic
public class WaterMagic : IMagic
{
public override void CountYourMagic()
public void CountYourMagic()
{
Console.WriteLine("Incredible! You have 50 millions of power! It's water magic!");
}

View file

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Open_Closed.Interfaces
{
public interface IMagic
{
void CountYourMagic();
}
}

View file

@ -1,2 +1,5 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
using Open_Closed.Classes;
(new FireMagic()).CountYourMagic();
(new WaterMagic()).CountYourMagic();
(new UnknownMagic()).CountYourMagic();

View file

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>