"Anders Eriksson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> If I have a structure that look like this
>
> foo
> bar1 or
> bar2 or
> bar3
>
> I. e. foo can contain either a bar1 or a bar2 or a bar3.
>
> How would class foo look like?
Given that you used the word "structure", I wonder whether you are thinking
of what in C/C++ would be a union? Union's are not supported in C# (although
if you google for it you can find some good simulations - although I suspect
these are only viable with value types not reference types). So you are left
with inheritance as the only viable way forward - see Arne's post.
--
Brian Cryer
http://www.cryer.co.uk/brian