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.

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

Updated

In other subjects