Instance (computer science): Difference between revisions

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Line 1: Line 1:
The word "instance" can refer, generally, to any running [[Process (computing)|process]], and can perhaps best be compared to the word "execution", as in "the execution of a set of instructions", but without the connotation of completion. For example, on a computer with a [[Computer multitasking|multitasking]] [[operating system]], a program or section of a program can be running in multiple "instances" simultaneously. In the case of a [[Graphical user interface|GUI]] program this would imply that each instance had its own window.
 
 
 
More specifically, in [[object-oriented programming]] an instance is an occurrence or a copy of an [[Object (computer science)| object]], whether currently executing or not. Instances of a class share the same set of attributes, yet will typically differ in what those attributes contain. For example, a class "Employee" would describe the attributes common to all instances of the Employee class. For the purposes of the task being solved Employee objects may be generally alike, but vary in such attributes as "name" and "salary". The description of the class would itemize such attributes and define the operations or actions relevant for the class, such as "increase salary" or "change telephone number". One could then talk about one instance of the Employee object with name = "Jane Doe" and another instance of the Employee object with name = "John Doe".
 
More specifically, in [[object-oriented programming]] an instance is an occurrence or a copy of an [[Object (computer science)| object]], whether currently executing or not. Instances of a class share the same set of attributes, yet will typically differ in what those attributes contain. For example, a class "Employee" would describe the attributes common to all instances of the Employee class. For the purposes of the task being solved Employee objects may be generally alike, but vary in such attributes as "name" and "salary". The description of the class would itemize such attributes and define the operations or actions relevant for the class, such as "increase salary" or "change telephone number". One could then talk about one instance of the Employee object with name = "Jane Doe" and another instance of the Employee object with name = "John Doe".
   

Revision as of 15:50, 29 November 2010

More specifically, in object-oriented programming an instance is an occurrence or a copy of an object, whether currently executing or not. Instances of a class share the same set of attributes, yet will typically differ in what those attributes contain. For example, a class "Employee" would describe the attributes common to all instances of the Employee class. For the purposes of the task being solved Employee objects may be generally alike, but vary in such attributes as "name" and "salary". The description of the class would itemize such attributes and define the operations or actions relevant for the class, such as "increase salary" or "change telephone number". One could then talk about one instance of the Employee object with name = "Jane Doe" and another instance of the Employee object with name = "John Doe".