I have 2 classes, A, B and B is a child of A.
and I have a function which processes a list of A.
void func(list<A> alist) {
// processing list of A
}
The problem is func() won't able to handle a list of B even B is a
child of A.
What can I do? The only way I can think of is making func a function
template, so I can plugin both A, and B. But I have a lot of
funcitons like this.
And I java I don't have this problem.
Since both A and B are child of Object and I just pass in a list of
Object
and instead func() I just need to subcast that to A (which will work
for both class A and B (a child of A).
Thanks for any help.