Static Member
noun
say it: “STAT-ik MEM-ber” /ˈstætɪk ˈmɛmbər/
A field, property or method that belongs to the class itself and is shared by all its 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);
In a sentence
- “TaxRate is a static member, so every order shares the same rate.”
Level: Apprentice · More OOP terms at this level
Updated