Question Class reference variables

WebKill2k

Member
Joined
May 15, 2008
Messages
14
Programming Experience
1-3
I am building a class and in it I want to reference some constant information, but I wanted to set it up in a certain way. Let's say for instance I want to reference locations, I would have State, City, then location, I would want to lay it out like this:

State.City.Location with location being a point

The idea is to be able to set these up in my class so that in the main code I can use this when calling certain functions, that way a point can be manually entered, or I could use this to type it in as a textual reference to what I need.

What is the best way to achieve this result so that I can type in the first variable such as Ohio, then with a period bring up a list of cities I have defined, followed by the piece of data I want.
 
What you describe is not happening and shows an incorrect understanding of how OOP works. Can you describe what you're actually trying to achieve with this? It's hard to know what the best course of action would be without knowing the actual end game.
 
Sorry, I know I'm not explaining this very well. I guess what I am looking for is something like a nested class or structure?

The one thing I can do is lists, so make a dictionary or sortedlist with a key of string to be the city, and a value of a point to be the location, then one list per state and I can grab the values by using State(city).location. Then I suppose I could an enum instead of string for the city to make it easier.
 

Latest posts

Back
Top