Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

change attribute here, update attribute there

1 view
Skip to first unread message

Delirium tremens

unread,
Dec 11, 2008, 5:28:21 PM12/11/08
to
If an attribute was changed in one object and you needed it updated
for use in an other, what would you do? What if this happens many
times?

Curtis

unread,
Dec 11, 2008, 8:58:14 PM12/11/08
to

Your question was already being addressed in the first thread you
started.

--
Curtis
$email = str_replace('sig.invalid', 'gmail.com', $from);

Jerry Stuckle

unread,
Dec 11, 2008, 9:02:24 PM12/11/08
to

I would redesign my class hierarchy. If you have that problem, you have
a basic design problem, as I said before.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================

trookat

unread,
Dec 11, 2008, 9:20:33 PM12/11/08
to
Jerry Stuckle wrote:
> Delirium tremens wrote:
>> If an attribute was changed in one object and you needed it updated
>> for use in an other, what would you do? What if this happens many
>> times?
>
> I would redesign my class hierarchy. If you have that problem, you have
> a basic design problem, as I said before.
>

Jerry could he use something like;

create a variable to hold the object and cross update when he makes changes

$person=new person();
$object1=new object_test();
$object2=new otherobject();
$object1->person=$object2->person=$person;

$person->name='fred';
$object1->person=$object2->person=$person;


or even use pointers to point at the same data?
$person=new person();
$object1=new object_test();
$object2=new otherobject();
$object1->person=$object2->person=& $person;

$person->name='fred'; //should update both objects

regards trookat

Jerry Stuckle

unread,
Dec 11, 2008, 9:30:11 PM12/11/08
to

He could use a reference, for instance. But the fact he needs to do it
points to a severe design problem.

Would you try to share the same steering wheel between two automobiles?
That's effectively what he's trying to do in his classes.

0 new messages