thanks... that's what kind of feedback I was looking for.
----- Original Message -----
From: "Nikolai Devereaux" <yomama@u...>
To: "professional php" <pro_php@p...>
Sent: Tuesday, August 21, 2001 9:04 PM
Subject: [pro_php] RE: accessing object properties
>
> Not necessarily. Using getters and setters to modify member variables of
> objects is just a standard OOP interfacing technique. Most objects have
all
> their member variables as private properties of that object, and all
> interfaces to the object should be done through an interface of publically
> accessible methods.
>
> The argument for using functions is that you can do additional type and
> bounds checking on data if you use getters and setters. If you have a
> person object with an int age property, you can say myPerson->age = -4; no
> problem, but if you write myPerson->setAge(-4), your setAge function could
> (should?) provide some sort of validity checks on the data.
>
> OOP is possible in PHP, but it's also possible to fudge it up quite a bit.
> If you're going to be using classes or objects in your design, it's good
> practice to use methods to perform all modifications on your object, and
> pretend that your member variables are off-limits.
>
> nik
>
>
> -----Original Message-----
> From: Joel Wickard [mailto:jwickard@l...]
> Sent: Tuesday, August 21, 2001 6:29 PM
> To: professional php
> Subject: [pro_php] accessing object properties
>
>
> Hello Everyone,
>
> The author of the beginning php book recommends creating accessor
functions
> for the properties of any classes you create..
>
> I always just access the properties directly i.e.
> $this_object->property = "whatever";
> $some_var = $this_object->property;
>
> I was just wondering if there were any pitfalls of not writing the
accessor
> functions and doing it the way I do.
>
> Thanks
>
>
>