> -----Original Message-----
> From: Behalf Of Nathan Rimmer
>
>
> I'm starting to get into OO programming with Perl and
> have a question.
>
> As I understand it with OO - you create an object and
> then do something to it.
>

The definition of a object is data and behavior that affects that data.

> I have a list of values in an array and I wish to do
> the same "something" to all of them.
>
> Do I need to create an object for each value in the
> array and then do something to all of them ?
>
> Or can I create 1 object and do the "something" to all
> the values from within that 1 object ? (if that makes
> sense !)
>

Either.  It depends on what you are doing.

Are the values in the array truly objects?  It could be that you object is a
container (an intelligent array.)  Or it could be that your object has a
list of data which it needs to do its job.  A container will often contain
other objects.

If the data will never be exposed outside the object then it is probably
just data.  But you might make the data items objects simply for
convienence.

If the data would be exposed, then it is more likely that should be an
object.  Or that your 'container' object isn't really an object.  That is
one way to really tell if an object is an object, whether the data, rather
than the behavior, is needed outside the object (this is often a matter of
granularity, too much or too little.)

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to