Saturday, March 20, 2010

Classes

In object-oriented software, it’s possible to have many objects of the same kind that
share characteristics: rectangles, employee records, video clips, and so on. A class is
a software blueprint for objects. A class is used to manufacture or create objects.
The class declares the instance variables necessary to contain the state of every
object. The class would also declare and provide implementations for the instance
methods necessary to operate on the state of the object.
Definition: A class is a blueprint that defines the variables and the methods
common to all objects of a certain kind.

After you’ve created the class, you can create any number of objects from that
class.
A class is a kind of factory for constructing objects. The non-static parts of the
class specify, or describe, what variables and methods the objects will contain. This
is part of the explanation of how objects differ from classes: Objects are created and
destroyed as the program runs, and there can be many objects with the same structure,
if they are created using the same class.

No comments:

Post a Comment