No we should not support enum types derived from strings
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Wed May 12 16:38:10 UTC 2021
On Wednesday, 12 May 2021 at 15:35:26 UTC, deadalnix wrote:
> Ok, consider the following.
>
> class A {};
> class B: public A {};
>
> A *a = new B();
>
> tyepid(a) is A*. In C++, a is monomorphic.
> typeid(*a) is B. In C++, *a is polymorphic.
Sadly, IIRC typeid(*a) is A, because A does not contain a virtual
member...
typeid(a) is A*, because that is the type of the pointer.
However, the relationship between B* and A* is polymorphic,
because you can use B* in the context where you expect A*? E.g.
you can call a function that expects paramater A* with a pointer
B*. So that makes the relationship polymorphic?
I have to admit I never use the terminology monomorphic and
polymorphic, so my understanding could be wrong. If so, I am
probably not alone in the thread, so for the sake of other
readers, maybe someone can provide a definition for monomorphic?
More information about the Digitalmars-d
mailing list