Results 1 to 3 of 3

Thread: instance of an object

  1. #1
    Join Date
    Nov 2011

    instance of an object

    What it means by create an instance of an object ? The words instance means in programming.. ?

  2. #2
    Join Date
    Aug 2010
    San Diego
    In traditional (class based) OOP, there are classes and objects. Every object has a class, and an object is an instance of its class. Classes create objects and determine their behavior. All objects of the same class have the same behavior, that is they share the same set of methods (or functions).

  3. #3
    Join Date
    Dec 2003
    Bucharest, ROMANIA
    Objects are instances. Instances of a class.

    If you consider a class as being the blue print of a standard apartment in the block where I live, my apartment is an instance, my neighbor's apartment is another instance, ... They share the same project (the class), but they are different apartments (instances [objects] of that class). They have identical properties, but their properties have different values. My bathroom is painted in blue, while my neighbor's is white.

    But, as you put this question into the JavaScript Forum, you should know that JavaScript has no classes, thus it has no instances (in the way they are defined in classical OOP). In JavaScript everything is (or can be transformed into) an object. Objects are to be created in several ways. From these, using a constructor (a new function) is more alike using a class (in other languages). But objects, in JavaScript, are not the instances of a constructor. JavaScript objects have a prototype, which is something different from a class, because JavaScript uses the delegation (from object to its prototype), not the inheritance (from a class to an instance). If I take the example with my apartment, I can alter the blue print (its prototype), and split a room in two by rising a wall without altering my neighbor's apartment blue print
    Last edited by Kor; 05-11-2012 at 04:01 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles