>I have a moment of brain shortage, right now I can't see the forest for all the trees. Is it possible from within an object to know what is the name it's instantiated as? Given this code
>
>
>loCountries = NewObject('SqlTable','SQL.vcx')
>
>In this case I want the class SqlTable to understand that it's instantiated as loCountries. I am building a rather complicated generic class to work with SQL tables. My idea is that if I call the object for instance loCountries, my class can be smart enough to know that I want it to connect to the SQL table called Countries.
Hi Tore:
You can't query the object name, and scanning all memory objects looking for the class name is a bad apporach, so I suggest tyhe simplest solution, indicating the instantiated mode as one more parameter:
loCountries = NewObject('SqlTable', 'SQL.vcx', 'countries')
loCountries = NewObject('SqlTable', 'SQL.vcx', 'other-uses')
Edit: Another solution could be using some factory object, like this:
loCountries = oFactory.NewCountry('SqlTable')
loCars = oFactory.NewCar('SqlTable')
Best Regards!
Fernando D. Bozzo
Madrid / Spain