Default Constructor

noun

say it: “dih-FAWLT kun-STRUK-ter” /dɪˈfɔːlt kənˈstrʌktər/

A constructor with no parameters, which C# adds for you when a class declares no constructor of its own.

What is Default Constructor in C#?

Default Constructor — A no-argument constructor supplied by the compiler when a class declares none.

class Store
{
    static int locationCount = 3;
    const int maxItems = 100;
    readonly string name;

    Store(string name)
    {
        this.name = name;
    }
}

In a sentence

  • “Book has no constructor, so new Book() uses the default constructor.”

Level: Journeyman · More C# terms at this level

Updated

In other subjects