CSharp - What is the output: abstract constructor

Question

What is the output from the following code

using System;

class MyTestClass
{
    abstract MyTestClass()
    {
        Console.WriteLine("abstract constructor");
    }
}

class Program
{
    static void Main(string[] args)
    {
        MyTestClass ob = new MyTestClass();
    }
}


Click to view the answer

//Constructors cannot be abstract or sealed
abstract MyTestClass()//Error
{
   Console.WriteLine("abstract constructor");
}

Note

We usually use the keyword abstract with a class to indicate that it is incomplete.

Constructors cannot be overridden.

Related Quiz