typeid of variable of interface type holding reference to derived class
Adam D. Ruppe
destructionator at gmail.com
Thu Dec 24 16:43:53 UTC 2020
Interfaces always give their own typeid, this is because they
might point to an object that doesn't have RTTI (though the
compiler SHOULD be able to figure that out statically, it doesn't
try).
To get the dynamic type, first cast it to Object, then type id.
typeid(cast(Object) o) is typeid(WhateverClass)
More information about the Digitalmars-d-learn
mailing list