Basic – Computing
Reading Time – 1 minute, 12 seconds
The instance definition is referred to as a unique occurrence of an object which represents a class at a particular time. An object is a memory element that stores data temporarily and class is a program code that acts as a template to create objects.
The instance of an object carries detailed information of an object. During program execution, if a variable changes its value from one instance to another, then that variable is called an instance variable.
The use in programming
In computer programming, a class is used to define the properties and behaviors of an object. The programmers use the concept of instances to create objects with specific details. The instance describes the relationship of an object to its class.
For example, suppose in your program you have written a class called a “Car” to represent the generic properties and behaviors of a car such as its manufacturer, model, color, mileage, maximum speed and ability to perform automatic transmission. Now you create an object of the class “Car” and name it as “My car” specifying details of your car’s properties and behaviors such as manufacture is Toyota, color is black, mileage is 10,000 km and can perform automatic transmission. This instance “My car” is a unique occurrence of an object which represents the class “Car”. Inside the program, you can use this instance to change its properties by assigning different values to them.