Is the memory address of classinfo the same for all instances of a class?
Heywood Floyd
soul8o8 at gmail.com
Fri Jul 2 06:24:20 PDT 2010
Good day!
Consider
// - - - -
class Foo{}
auto one = new Foo();
auto two = new Foo();
writefln("one: %x two: %x", &one.classinfo, &two.classinfo);
// - - - -
For me this results in two identical memory addresses "every time".
Can I rely on this?
Can I design software based on the assumption that these addresses are always the same?
(I'd like to be able to use the memory address as the key in an associative array, for quick by-class
lookups.)
BR
/heywood
More information about the Digitalmars-d-learn
mailing list