CSharp - Implicit calling parameterless base-class constructor

Introduction

If a constructor in a subclass omits the base keyword, the base type's parameterless constructor is implicitly called:

class BaseClass
{
       public int X;
       public BaseClass() { X = 1; }
}

class Subclass : BaseClass
{
       public Subclass() { 
          Console.WriteLine (X); 
       }  // 1
}

If the base class has no accessible parameterless constructor, subclasses must use the base keyword in their constructors.

Related Topic