# Method

A function that belongs to a class and describes something its objects can do.

## What is **Method**?

A **method** is a function that belongs to an object or class. It is something the object can *do*, often using its own data. `cart.AddItem(book)` calls the `AddItem` method on the cart.

```csharp
public class ShoppingCart
{
    private readonly List<string> items = new();

    public void AddItem(string item) => items.Add(item);
}
```

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

Updated: September 27, 2026

## In other subjects

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

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