I am perplexed by an error that I have not been able to figure out
I store an index and an object as a pair in Dictionary object
dictobj.add i, MyclassA
where MyclassA is an instance of Myclass
so I retrieve the value by calling dictobj(i)
But I find that whatever "friend" properties I have in Myclass I could not directly access them as:
dictobj(i).k
if k is declared as friend in Myclass
However if I first assign dictobj(i) to a variable of type Myclass:
set A=dictobj(i)
then A.k is totally legit and the compiler will not complain.
If I access it by dictobj(i).k the compiler will immediately put up error 438 to complain of "no such method or properties" as if it were not even visible to it.
I am doing all this within the same project but I am not too sure why it is behaving this way.
My suspicion is that whatever Dictionary returns as value is still considered as in its own space and it's a kind of variant object (it is not aware of its real type - it really does not care). Since it is an external library that is linked into my main project, it cannot directly access any properties declared as friend. I am not so sure whether this explains what I am seeing.
However, if I declare K as public the behaviour is no longer observed. It will compile without any complaint at all.
So dictobj(i).k is perfectly legit again.
Why declaring public versus friend cause such big difference?
Bookmarks