In object-oriented programming, a class is an extensible program-code-template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions or methods). In many languages, the class name is used as the name for the class (the template itself), the name for the default constructor of the class (a subroutine that creates objects), and as the type of objects generated by instantiating the class; these distinct concepts are easily conflated.
When an object is created by a constructor of the class, the resulting object is called an instance of the class, and the member variables specific to the object are called instance variables, to contrast with the class variables shared across the class.
In some languages, classes are only a compile-time feature (new classes cannot be declared at runtime), while in other languages classes are first-class citizens, and are generally themselves objects (typically of type Class or similar). In these languages, a class that creates classes is called a metaclass.
It can refer to a course itself, e.g., a class in Shakespearean drama.
It can be the group of students at the same level in an institution: the freshman class; or the group of students which graduates from the institution at the same time: the Class of 2005 (cf.alumnus/a). The term can be used in a slightly more general context, such as "the graduating class."
It can also refer to the classroom, in the building or venue where such a lesson is conducted.
In some countries' educational systems (such as Taiwan's), it can refer to a subdivision of the students in an academic department, consisting of a cohort of students of the same academic level. For example, a department's sophomores may be divided into three classes.
In countries such as the Republic of Ireland, India, Germany, and in the past Sweden, the word can mean a grade: 1st class is ages 4–5, 2nd class is ages 6–7, 3rd class is ages 8–9, 4th class is ages 9–10, 5th class is ages 10–11, 6th class is ages 11–12, and 9th class is ages 14–15.