A
Adam Clauss
OK, I have class A defined as follows:
class A
{
A(Queue<B> queue) { ... }
}
Now, I then have a subclass of both classes A and B. The subclass of A
(SubA), more specifically is passed a Queue<SubB>.
class SubA
{
SubA(Queue<SubB> queue)
: base (queue)
{ ... }
}
This, at first glance appears to be correct, because if a queue contains all
elements of type SubB, then those by definition are also of type B. So, the
types should be compatible.
However, upon compiling, I get an error saying it cannot convert the types.
Further, Queue does not have a Convert() method, as the List does. Any
suggestions on how to solve this?
Thanks
class A
{
A(Queue<B> queue) { ... }
}
Now, I then have a subclass of both classes A and B. The subclass of A
(SubA), more specifically is passed a Queue<SubB>.
class SubA
{
SubA(Queue<SubB> queue)
: base (queue)
{ ... }
}
This, at first glance appears to be correct, because if a queue contains all
elements of type SubB, then those by definition are also of type B. So, the
types should be compatible.
However, upon compiling, I get an error saying it cannot convert the types.
Further, Queue does not have a Convert() method, as the List does. Any
suggestions on how to solve this?
Thanks