[Tutor] Problems with references

Martin Hjort Eriksen martin at hardcoder.dk
Wed Jun 2 05:37:16 EDT 2004


>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', 
>  
>

agreed....and in php5 it is also prefixed with a static.

But I do disagree that the basic idea that attributes should be shared 
across objects. The basic idea of objects, is that they can take 
different states. These states are described through the attributes that 
the object has. This requires that the attributes are not shared between 
instances. But in some cases it is necessary that you have the ability 
to share attributes, but that should be rather rare, since the best 
practice is that each object is as much as possible encapsulated from 
everything else.

/Martin




More information about the Tutor mailing list