You are here: Re: Listing objects « PHP Programming Language « IT news, forums, messages
Re: Listing objects

Posted by Peter Fox on 12/30/05 12:19

Following on from Lüpher Cypher's message. . .
>Hi,
>
>Suppose we have a hierarchical class structure that looks something like
>this:
Sorry, I lost the plot half way through.

Your objects can be
1 - nesting : object has a 'what are my children' and 'who is my
parent' functionality.

2 - pointing : eg object has a 'these are my siblings' or
'previous/next' functionality

3 - dictionary entries : object in some container is discoverable by
name

Variations and combinations of course apply. BUT every object exists in
some context. I /think/ you might be trying to get A's to point-to/own
B's where more than one A could be the parent of a B. Eg
"Sally is daughter of Jean"
"Geoffrey is son of Teddy"
"Sally is daughter of Teddy" // Only one Sally! J+T are married.

In this case[1] create an array of children and point to elements in
that array from your parent objects.

eg $child['Sally'] = new ChildObj(.....);
then $Jean->AddChild('Sally') // just a key name or index
or $Jean->AddChild($child['Sally']) // inside the routine do $myKids[]
= & $NewChild
where $NewChild is the function argument.

[1] If in this example children can be parents then you should be
looking at a single universal 'person' class with the necessary links.






--
PETER FOX Not the same since the adhesive company came unstuck
peterfox@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация