What can be instantiated?
c++, oop
Solution
So long as we're talking about C++, the only authoritative source is the ISO standard. That doesn't ever use the word "instantiation" for anything but class and function templates.
It does, however, use the word "instance". For example:
An instance of each object with automatic storage duration (3.7.2) is associated with each entry into its block.
Note that in C++ parlance, an `int` lvalue is also an "object":
The constructs in a C++ program create, destroy, refer to, access, and manipulate objects. An object is a region of storage.
Since `new` clearly creates regions of storage, anything thus created is an object, and, following the precedent of the specification, can be called an instance.
Problem
What types in C++ can be instantiated? I know that the following each directly create a single instance of `Foo`: ``` Foo bar; Foo *bizz = new Foo(); ``` However, what about with built-in types? Does the following create two instances of `int`, or is instance the wrong word to use and memory is just being allocated? ``` int bar2; int *bizz2 = new int; ``` What about pointers? Did the above example create an `int *` instance, or just allocate memory for an `int *`? Would using literals like `42` or `3.14` create an instance as well? I've seen the argument that if you cannot subclass a type, it is not a class, and if it is not a class, it cannot be instantiated. Is this true?