Instance

In (OOP), an instance is a concrete occurrence of any, existing usually during the  of a computer program. Formally, "instance" is synonymous with "object" as they are each a particular value (realization), and these may be called an instance object; "instance" emphasizes the distinct identity of the object. The creation of an instance is called instantiation. The term "Instance" can also refer, in a non object oriented manner, to any program that is executing. Eg., the executing process in an instance of the program (see below).

In, objects are created from by s called , and destroyed by. An object is an instance of a class, and may be called a class instance or class object; instantiation is then also known as construction. Not all classes can be instantiated – es cannot be instantiated, while classes that can be instantiated are called es. In, instantiation is instead done by copying (cloning) a prototype instance.

An object may be varied in a number of ways. Each realized variation of that object is an instance of its class. Each time a runs, it is an instance of some. That is, it is a member of a given class that has specified rather than. In a non-programming context, you could think of "dog" as a type and your particular dog as an instance of that class.

An important distinction is between the, which is interface, and the , which is implementation.

The meaning of the term "type" in computer science is rather similar to the meaning of the word "type" in everyday language. For example, a barman can ask a client what type of beverage does he or she want – coffee, tea or beer? A particular cup of coffee that the client receives is in the role of an instance, while two cups of coffee would form a set of two instances of coffee, determining its type at the same time.