# Polymorphism in C#: an overview

Polymorphism means "many forms". An object can be seen in more than one way, and code can work with whichever way it needs.

Apprentice · C# · OOP · Updated November 15, 2026

By Gregor Dzierzon

## After this lesson you can

- Explain polymorphism as one object seen in many forms

## Key takeaways

- Polymorphism means "many forms": one object can be seen in more than one way, as Chloe is a student, a singer and an athlete.
- An archer is a character, so an `Archer` object can be seen as an `Archer` or simply as a `Character`.
- Code that only cares about characters can treat an archer, a wizard and a knight the same way, without knowing which kinds exist.

**Polymorphism** sounds like a big word, but the idea is an everyday one. The word has two parts:

- **poly**, meaning *many*,
- **morph**, meaning *forms*.

A polymorphic object is one that can be seen in **many forms**. That doesn't mean it changes shape like a wizard in a story. It means different people, or different code, can look at the same object in different ways.

## One person, many roles

Take Chloe, a high school student. Looking at her, you know she's a person, and not much more.

![Chloe, a high school student](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/09/5b22e8d286304ca4baa14ec0ba625ce1.png "Chloe, a high school student")

But Chloe is a math scholar, she sings in the school plays, and she plays on the volleyball team.

![Chloe is a scholar, a singer and an athlete](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/09/6196e5556a454d01924232019798f641.png "Chloe is a scholar, a singer and an athlete")

She's one person, in many forms: a student to her teacher, a singer to the drama club, an athlete to her coach.

## Many forms in code

You've already met this in C#. An archer **is a** character. So an `Archer` object can be seen in two forms:

- as an **`Archer`**, with arrows and everything else an archer has,
- or simply as a **`Character`**, like any other character in the game.

Code that only cares about characters (a battle, a party list, a save file) can treat an archer, a wizard and a knight all as characters, and work with all three the same way. That's polymorphism, and the next lessons show what it looks like.

## Do it: add up the whole party's health

Before a battle, the game shows the party's health, added up. The party is a mix of archers, wizards and knights, but health is something every character has. So the method can treat each member as a `Character`, whatever kind it is.

The classes are given: `Character`, with a `Name` and a `Health`, and three kinds of character, each with its own starting health:

- an `Archer` starts with `100` health,
- a `Wizard` starts with `80`,
- a `Knight` starts with `120`.

The method gets one value:

- `party`: a `List<Character>` holding the party's members, of any kind.

For example:

```csharp
List<Character> party = new List<Character>
{
    new Archer("Robin"),
    new Wizard("Merlin"),
    new Knight("Lancelot")
};
```

| Member | Kind | Health |
|---|---|---|
| Robin | Archer | 100 |
| Merlin | Wizard | 80 |
| Lancelot | Knight | 120 |
| **The party** | | 100 + 80 + 120 = **300** |

So `TotalHealth(party)` returns `300`.

**Your job:** write the method `TotalHealth(List<Character> party)` so it returns an `int`: every member's `Health`, added up.

- Treat every member the same way, as a `Character`, whatever kind it is.
- An empty party returns `0`.

Practiced live on the lesson page: write the C# right there and check it.

## Check yourself

1 question to try on the lesson page.

## So what

Polymorphism lets code see an object in the form it needs. One loop can handle every kind of character, without knowing or caring which kinds exist.

## Key terms

- [Polymorphism](https://www.ask-codey.com/glossary/polymorphism-c-sharp)

## Cheat sheets

- [Polymorphism in C#](https://www.ask-codey.com/cheat-sheets/polymorphism-in-csharp-an-overview-cheat-sheet)

Source: https://www.ask-codey.com/lessons/polymorphism-in-csharp-an-overview
