On Friday, 6 April 2018 at 01:14:37 UTC, ketmar wrote:
Kayomn wrote:
[...]
it is already done for you, free of charge.
class Node {}
class RootNode : Node {}
class SpriteNode : Node {}
void main () {
auto nodeId1 = typeid(Node);
auto nodeId2 = typeid(SpriteNode);
auto comparison = typeid(Node);
Node n = new SpriteNode();
assert(typeid(Node) is typeid(Node)); // obviously
assert(typeid(SpriteNode) !is typeid(Node)); // sure
assert(typeid(Node) is nodeId1);
assert(typeid(n) is nodeId2);
}
Oh neat, thanks. I've been really scraping my head over this, and
was worried I wouldn't be able to keep supporting my D version of
the project.