Notes

Similarly, in C#, providing a body for an abstract method will result in a compilation error:

abstract class Animal
{
    // Abstract method declaration with a body (which is not allowed)
    public abstract void MakeSound()
    {
        Console.WriteLine("Generic Animal Sound");
    }
}

class Dog : Animal
{
    // Compiler error: 'Dog' does not implement inherited abstract member 'Animal.MakeSound()'
}

Last updated