Static Member
Data or a method that belongs to the class itself, shared by all objects.
What is Static Member?
A static member belongs to the class itself, not to any one object. Every object shares it, and you use it through the class name, like Math.Max(3, 7).
public class Ticket
{
public static int TicketsSold = 0; // shared by every ticket
public Ticket() => TicketsSold++;
}
Console.WriteLine(Ticket.TicketsSold);
Level: Apprentice · More OOP terms at this level
Updated