Code Fix

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

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

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

 1  abstract class Shape {
 2      public abstract double Area();
 3  }
 4  class Circle : Shape {
 5      public double Radius;
 6      ________________________________________________________________
                                        ^
 7  }
 8  class Program {
 9      static void Main(string[] args) {
10          Circle c = new Circle { Radius = 2 };
11          System.Console.WriteLine(c.Area());
12      }
13  }
Program.cs(4,7): error CS0534: 'Circle' does not implement inherited abstract member 'Shape.Area()'

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

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

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

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

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