[Tutor] Dumb question

Kirby Urner urnerk@qwest.net
Fri, 18 Jan 2002 21:48:21 -0800


At 11:45 PM 1/18/2002 -0500, ccl wrote:

>I'm not a programmer, so this is a kinda dumb question. What exactly is a 
>class? Why would use one? How do you define one? I've done alot of reading 
>on Python and this whole concept escapes me.
>
>Thanks
>
>Chris

A class is a blueprint.  An instance is the thing you make
from the blueprint.  One class, many instances.

A subclass is a blueprint that inherits all the features
of its parent(s), but then contains modifications.  The
programmer can just focus on what's different, knowing
the full-featured parent is in the background.

You can also compose classes (not just subclass 'em).
Write a blueprint in which instances of other classes
are used internally, by instances of the class you're
designing.

Like, a house blueprint uses instances of wall, floor,
and plumbing classes.

Classes typically contain properties and methods.  When
you create an instance of a class, it'll be ready to
have its properties set, and to have its behaviors
triggered.  The toilet object flushes and refills,
has states:  ready, filling, flushing, broken.

Kirby