I'm trying to develop a bunch of classes and want to do it the right
way.
Say I have 5 classes:
City,
Neighborhood,
NeighborhoodCol lection,
House,
HouseCollection
The collection classes are strongly typed collections which inherit
System.Collecti ons.CollectionB ase
So once I instanciate everything I need, I may use it as follows:
City.Neighborho odCollection(2) .Housecollectio n(3).value
So here's my question:
I have a sub in the House class which needs to access some property of
the City class. For example, when calling house.GetAverag eIncome(), the
sub needs to know which City the house is in. Make sense?
The only way I was able to figure out how to do this was to pass a
reference down to each child object (when sub new() was called in City,
it populated its NeighborhoodCol lection members and created a
NeighborhoodCol lection.MyParen t reference to itself):
dim NeighborhoodToA dd as Neighborhood = new Neighborhood
NeighborhoodToA dd.MyParent = City
City.Neighborho odCollection.Ad d(NeighborhoodT oAdd)
This got ugly fast. How should I be referencing the properties in a
class' parent?
Thanks!
=============== =
Jordan Bowness
=============== =
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
way.
Say I have 5 classes:
City,
Neighborhood,
NeighborhoodCol lection,
House,
HouseCollection
The collection classes are strongly typed collections which inherit
System.Collecti ons.CollectionB ase
So once I instanciate everything I need, I may use it as follows:
City.Neighborho odCollection(2) .Housecollectio n(3).value
So here's my question:
I have a sub in the House class which needs to access some property of
the City class. For example, when calling house.GetAverag eIncome(), the
sub needs to know which City the house is in. Make sense?
The only way I was able to figure out how to do this was to pass a
reference down to each child object (when sub new() was called in City,
it populated its NeighborhoodCol lection members and created a
NeighborhoodCol lection.MyParen t reference to itself):
dim NeighborhoodToA dd as Neighborhood = new Neighborhood
NeighborhoodToA dd.MyParent = City
City.Neighborho odCollection.Ad d(NeighborhoodT oAdd)
This got ugly fast. How should I be referencing the properties in a
class' parent?
Thanks!
=============== =
Jordan Bowness
=============== =
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Comment