Runtime Type Information (RTTI)
Part of TutorialIntermediate
Description
You can find out some class information during runtime.
Example
import std.c.stdio; class A {} int main ( char [] [] args ) { A a = new A; Object o; o = new Object; bit b; printf("%.*s\n", a.classinfo.name); printf("%.*s\n", o.classinfo.name); /* These aren't allowed... */ // printf("%.*s\n", b.classinfo.name); // printf("%.*s\n", b.typeinfo.name); return 1; }
More Information
See also:
- http://www.prowiki.org/wiki4d/wiki.cgi?HowTo/RealtimeTypeInformation
- http://www.prowiki.org/wiki4d/wiki.cgi?FaqRoadmap#DoesDsupportanyformofRTTI
Source
| Link | http://www.dsource.org/tutorials/index.php?show_example=34 |
| Posted by | jcc7 |
| Date/Time | Mon May 3, 2004 12:18 am |
