A
A
AbnormalUnit2011-11-02 12:21:28
C++ / C#
AbnormalUnit, 2011-11-02 12:21:28

Storing inherited C# objects?

Let's say some kind of simple hierarchy:

class Base<br/>
{<br/>
}<br/>
<br/>
class A:Base<br/>
{<br/>
}<br/>
<br/>
class B:Base<br/>
{<br/>
}

I would like to store instances of both classes of heirs in a list of type List. Is it possible to implement this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2011-11-02
@GavriKos

Yes. Store instances of base in list - this is what inheritance was actually invented for.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question