Showing posts with label Theory. Show all posts
Showing posts with label Theory. Show all posts

Saturday, May 12, 2012

What is an instance?

An instance is created from a class. The class can be seen as a blueprint and the instance is the actual object that is created from the blueprint. The class can make several objects or instances with different attributes. A Car Class would be able to have different instances for example, such as BMW, Honda, Jaguar, Mercedes.

In my own words,

an instance is a particular case in which an object is created from a set of defined attributes and functions from a blueprint or class.

Friday, May 11, 2012

What is a class?

A class is a blueprint or a model on which individual objects or instances can be created. A class will contain variables, methods that describe its behaviours. A class usually represents a blueprint of a real-life object that needs to be represented.

Example: The car Honda can be an instance of a Car class. It will have its own set of properties includign the color, model, design, number of doors etc. The instance, Honda, will have different properties than another instance of the car class, Ferrari for example.

12/5/12 Edit:

A class is a blueprint that contains attributes and functions that will be used to create instances as a representation of something.