Checking runtime object type

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Feb 8 11:20:39 PST 2012


What's the correct syntax for checking the runtime type of a derived
object given its base class pointer? I tried:

	Base f() { return new Derived(); }
	Base b = f();
	assert(is(typeof(b)==Derived));

but it throws an error. Apparently typeof(b)==Base; so typeof returns
only compile-time information? How do I get at the runtime type?


T

-- 
"You are a very disagreeable person." "NO."


More information about the Digitalmars-d-learn mailing list