Update Lesson 4 Task 2
This commit is contained in:
parent
3f3a735aa7
commit
9e80815935
6 changed files with 34 additions and 12 deletions
|
@ -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!");
|
||||
}
|
|
@ -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...");
|
||||
}
|
|
@ -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!");
|
||||
}
|
13
Lesson_4/Task_2/Interfaces/IMagic.cs
Normal file
13
Lesson_4/Task_2/Interfaces/IMagic.cs
Normal 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();
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
|
Reference in a new issue