Constructor
noun
say it: “kun-STRUK-ter” /kənˈstrʌktər/
A special method with the same name as its class that runs when an object is created, to set it up.
What is Constructor in C#?
Constructor — Special class code that initializes a new object.
class Store
{
static int locationCount = 3;
const int maxItems = 100;
readonly string name;
Store(string name)
{
this.name = name;
}
}
In a sentence
- “The Team constructor takes a name, so no team is ever created without one.”
Level: Journeyman · More C# terms at this level
Updated