Update Lesson 4 Task 2

This commit is contained in:
Stanislav Mykhailenko 2023-04-11 23:29:05 +03:00
parent 42aebfd7c7
commit f24c97cfb5
GPG key ID: 1E95E66A9C9D6A36
6 changed files with 21 additions and 8 deletions

View file

@ -8,7 +8,7 @@ using Open_Closed.Interfaces;
namespace Open_Closed.Classes namespace Open_Closed.Classes
{ {
public class FireMagic : IMagic public class FireMagic : IMagicClass
{ {
public int MagicValue { get { return 150; } } public int MagicValue { get { return 150; } }
public string MagicType { get { return "fire"; } } public string MagicType { get { return "fire"; } }

View file

@ -8,11 +8,11 @@ using Open_Closed.Interfaces;
namespace Open_Closed.Classes namespace Open_Closed.Classes
{ {
public class Magic public class Magic : IMagic
{ {
public void CountYourMagic(IMagic Magic) public void CountYourMagic(IMagicClass MagicClass)
{ {
Console.WriteLine($"Your magic is {Magic.MagicType}."); Console.WriteLine($"Your magic is {MagicClass.MagicType}.");
} }
} }
} }

View file

@ -8,7 +8,7 @@ using Open_Closed.Interfaces;
namespace Open_Closed.Classes namespace Open_Closed.Classes
{ {
public class WaterMagic : IMagic public class WaterMagic : IMagicClass
{ {
public int MagicValue { get { return 50000000; } } public int MagicValue { get { return 50000000; } }
public string MagicType { get { return "water"; } } public string MagicType { get { return "water"; } }

View file

@ -8,7 +8,6 @@ namespace Open_Closed.Interfaces
{ {
public interface IMagic public interface IMagic
{ {
int MagicValue { get; } void CountYourMagic(IMagicClass MagicClass);
string MagicType { get; }
} }
} }

View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Open_Closed.Interfaces
{
public interface IMagicClass
{
int MagicValue { get; }
string MagicType { get; }
}
}

View file

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