Wednesday, April 6, 2011

Objects


Object oriented programming was created to reduce the amount of time and effort that goes into creating new programs. Objects can be thought of as a level of organization or collection of like functions and variables into a single entity.

An object is a collection of variables (parameters) and functions (methods). The syntax for using an object is: object.parameter, or object.method(). This is the basic level of Object Oriented Programming. A collection is an array of variables/parameters held within an object.At the next level Objects can contain other objects. Each contained object has it’s own properties and methods. Objects can also contain arrays of sub objects.



Unlike variables that are declared, objects are instantiated. When a variable is declared using dim, it is empty; this is not the case when an object is instantiated. When an object is instantiated with the keyword “set”, the variable is a copy of the original object with all of its properties and methods, and contained objects. Normally when objects are created they will have default values for any of the critical properties, so that you won’t have to worry about them when you create a copy.



Syntax: Set variable = object
Example: Set FormObject = document.form1

No comments:

Post a Comment