|
|||||
What is 'first class object'?A first-class object is one that can be dynamically created, destroyed or passed as an argument. So, for example, all objects in C++ are also first-class objects. They can be created or destroyed through use of constructor or destructor methods, respectively, and be passed as arguments to functions. However, functions and methods in C++ are not first-class, as they cannot be created at runtime. In functional languages, functions are first-class objects, as they can be passed around as arguments to other functions and can be created dynamically at run-time. In C++, classes are not first class -- though in some languages (LISP's CLOS, for example) they are (as classes are objects). Other Terms |