Instance

Updated: 04/26/2017 by Computer Hope

An instance may refer to any of the following:

1. In programming, an instance is one occurrence of a class or object. For example, a program may have a class/object named Animal, but there could be many instances of Animal, such as lion, cat, and dog. An example using JavaScript is shown below where the Animal object is created, followed by three instances.

function Animal(numlegs, mysound) {
this.legs = numlegs;
this.sound = mysound;
}
var lion = new Animal(4, "roar");
var cat = new Animal(4, "meow");
var dog = new Animal(4, "bark");

The Animal object allows for the number of legs and the sound the animal makes to be set by each instance of the object. In this case, all three instances (lion, cat, and dog) have the same number of legs, but make different sounds; This process allows for items of similar structure, or that perform similar functions to reuse code, rather than duplicating it.

2. When referring to MMORPGs, an instance is a location created for a single player or group of players. This process allows multiple groups of players to run through the same content, without having to wait for another group to finish.

Class, Game terms, Object, Programming terms, Subroutine, Zone