In some languages, classes are only a compile-time feature (new classes cannot be declared at runtime), while in other languages classes are , and are generally themselves objects (typically of type Class or similar). In these languages, a class that creates classes is called a .
Class vs. type[]
In casual use, people often refer to the "class" of an object, but narrowly speaking objects have type: the interface, namely the types of member variables, the signatures of (methods), and properties these satisfy. At the same time, a class has an implementation (specifically the implementation of the methods), and can create objects of a given type, with a given implementation. In the terms of type theory, a class is an implementation—a concrete and collection of subroutines—while a type is an . Different (concrete) classes can produce objects of the same (abstract) type (depending on type system); for example, the type Stack might be implemented with two classes – SmallStack (fast for small stacks, but scales poorly) and ScalableStack (scales well but high overhead for small stacks). Similarly, a given class may have several different constructors.
Metaclasses[]
Metaclasses are classes whose instances are classes. A metaclass describes a common structure of a collection of classes and can implement a or describe particular kinds of classes. Metaclasses are often used to describe .
In some languages, such as , or , a class is also an object; thus each class is an instance of a unique metaclass that is built into the language. The (CLOS) provides (MOPs) to implement those classes and metaclasses.
https://en.wikipedia.org/wiki/Class_(computer_programming)