Updated: 04/26/2017 by Computer Hope

In object-oriented computer programming, a metaclass is one whose instances are also classes. For instance, in Python, the built-in class type is a metaclass: instances of class type are themselves a class of objects.

The use of metaclasses is most prevalent in object-oriented languages in which classes are "first-class" objects; meaning they can be used just like any other object in the language:

It is possible, but uncommon, to implement metaclasses in C++ and Java. More commonly, metaclasses can be found in programs written in Python, Ruby, Smalltalk, Perl, Objective-C, and Common Lisp/CLOS.

Object-oriented, Programming terms, Programming