C# Forum

Ask Question   UnAnswered
Home » Forum » C#       RSS Feeds

Error: 'TestCmd.Foo.Response()' is a new virtual member in a sealed class 'TestCmd.Foo'

  Asked By: Joel    Date: Oct 01    Category: C#    Views: 1765

I am getting following error any idea, what could be the possible cause.

class Class1
static void Main(string[] args)
Foo b1 = new Bar();
sealed class Foo
public virtual void Response()
Console.WriteLine("In Foo");
//Error: 'TestCmd.Foo.Response()' is a new virtual member in a sealed class 'TestCmd.Foo'



1 Answer Found

Answer #1    Answered By: Hattie Howard     Answered On: Oct 01

Is it because question is incorrect?

Someone told me sealed class  is final class and you cannot inherit it further and virtual  keyword is contradictory, as it can be overridden in child class and that is reason i am receiving this error.

This post is locked for further answers.