Re: determining what a ptr is pointing to by sklett
sklett
Tue May 11 14:32:48 CDT 2004
Thanks for the response!
I'm interested in this part of your response: "Better still, derive all the
structs from a common base struct which contains some way to identify
derived variants."
Would you mind going into a little more detail about this? It may be that
it is a common OOP term or suggestion, but I'm unclear.
I think you might be saying that I cast my pointer to the base struct, then
somehow from there I could tell which derived struct I'm dealing with. But
with OOP, when you are dealing with a base struct, you don't have access to
the derived structs. I'm not seeing how this all is connected.
"GuitarBill" <anonymous@discussions.microsoft.com> wrote in message
news:5B6B1AB1-690B-4BA2-8C83-028B55E07524@microsoft.com...
> If I understand you right, there's really no way to do that.
>
> One solution would be to put an identifying tag at the top of each struct.
Better still, derive all the structs from a common base struct which
contains some way to identify derived variants.