B
Bruno van Dooren
Hi all,
I have 2 classes:
class A{...};
class B : public A{...}
i manage all B instances in an array of A*.
A is a generic type that serves as a base type for a resource manager.
when i try to do
B* objectReference = dynamic_cast<B*>(aPointerToAnInstanceOfA);
i get compiler error:
error C2683: dynamic_cast : 'ManagedResource' is not a polymorphic type
apparently it is not enough that B inherits from A.
is there an elegant solution to this? or do i need to create a virtual dummy
method, however silly that would be?
kind regards,
Bruno.
I have 2 classes:
class A{...};
class B : public A{...}
i manage all B instances in an array of A*.
A is a generic type that serves as a base type for a resource manager.
when i try to do
B* objectReference = dynamic_cast<B*>(aPointerToAnInstanceOfA);
i get compiler error:
error C2683: dynamic_cast : 'ManagedResource' is not a polymorphic type
apparently it is not enough that B inherits from A.
is there an elegant solution to this? or do i need to create a virtual dummy
method, however silly that would be?
kind regards,
Bruno.