[Tutor] Problems with references
alan.gauld at blueyonder.co.uk
Wed Jun 2 05:17:11 EDT 2004
> >If the dictionary is defined as a class attribute it will be
> >shared across instances. That is what class attributes are for.
> That depends in what language you are working.
Nope, that is a basic tenet of OOP. The only language dependent
feature is how class attributes are implemented. For example
in C++ and Java they are prefixed with ''static', in Smalltalk
they are defined within a separate pane of the class browser
(they have a unique syntax too but I can't remember it! :-)
and in Objective-C they are prefixed by '+' rather than the
'-' used for instance members.
But the idea of class attributes is the same in all OOP languages.
Sorry to be picky, but for the sake of other newbies who might
be reading, the distinction is important :-)
Author of the Learn to Program web tutor
More information about the Tutor