[Newbies] System Browser: instance vs. class

Randal L. Schwartz merlyn at stonehenge.com
Sun Jan 31 23:13:50 UTC 2010


>>>>> "lanas" == lanas  <lanas at securenet.net> writes:

lanas>   I would like to know what is the practical difference between
lanas> instance and class in the System Browser.  Based on the Abstract
lanas> Factory example from Alpert's 'Desgin Patterns' book:

A class is always a singleton.  There is only one class named Car
in the system.  However, there can be many car instances, usually
created by sending "new" to "Car".

In the Car class, you'd hold information collectively about all cars,
such as the default specifications or number of cars produced.

In each car instance, you'd hold information about a specific car, like
its color or owner.

Does that help?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


More information about the Beginners mailing list