Code Fix

上級 › does not implement inherited abstract member の原因と直し方 › パターン5

does not implement inherited abstract member の原因と直し方

abstractなメンバーを持つ基底クラスを継承したのに、そのメンバーをoverrideしていないと出るコンパイルエラーです。

 1  abstract class Task {
 2      public abstract bool IsDone();
 3  }
 4  class Chore : Task {
 5      public bool Done;
 6      ______________________________________________
                               ^
 7  }
 8  class Program {
 9      static void Main(string[] args) {
10          Chore c = new Chore { Done = true };
11          System.Console.WriteLine(c.IsDone());
12      }
13  }
Program.cs(4,7): error CS0534: 'Chore' does not implement inherited abstract member 'Task.IsDone()'

空欄を埋めてビルドを通す

広告
広告スロット(未設定)

does not implement inherited abstract member の原因と直し方

このエラーの解説と類題をまとめて見る →

広告
広告スロット(未設定)