# Constructor

A special method that runs when an object is created and sets its starting values.

## What is **Constructor**?

A **constructor** is a special method that runs when a new object is created. It sets the object up with its starting values.

```csharp
public class Player
{
    public string Name { get; }
    public int Score { get; private set; }

    public Player(string name)
    {
        Name = name;
        Score = 0;
    }
}
```

Level: Novice · [More OOP terms at this level](https://www.ask-codey.com/glossary/subjects/oop/novice)

Updated: September 27, 2026

## In other subjects

- [Constructor in C#](https://www.ask-codey.com/glossary/constructor-c-sharp)
- [Constructor in Java](https://www.ask-codey.com/glossary/constructor)
- [Constructor in JavaScript](https://www.ask-codey.com/glossary/constructor-javascript)

Source: https://www.ask-codey.com/glossary/constructor-oop
