Abstract
クラスについての処理です。これから肉付けしていきます
Program.cs
using System;
public class Hello{
public static void Main(){
// Your code here!
Ice ice = new Ice();
}
}
public abstract class Attack
{
public Attack()
{
Console.WriteLine($"{Name()}攻撃");
Console.WriteLine($"相手に{Power()}ダメージ");
}
protected abstract string Name();
protected abstract int Power();
}
public class Ice:Attack
{
public Ice():base()
{
Console.WriteLine("相手は氷漬けになった");
}
protected override string Name()=>"氷";
protected override int Power()=>30;
}
サイト