Computer and Modernization ›› 2010, Vol. 1 ›› Issue (8): 120-123.doi: 10.3969/j.issn.1006-2475.2010.08.034

• 应用与开发 • Previous Articles     Next Articles

Analysis of RTTI Realization

HE Hong-hui1, LIU Ji-yu2   

  1. 1.Computation Center, Henan University, Kaifeng 475004, China;2.School of Software, Shangqiu Normal College, Shangqiu 476000, China
  • Received:2010-04-06 Revised:1900-01-01 Online:2010-08-27 Published:2010-08-27

Abstract: After compiling a source file by C++ compiler, the class definition information isn’t remained in object file. Therefore, the program at runtime can’t acquire the class information, such as class name,class hierarchy and so on, and consequently many operations such as dynamic_cast, persistence are impossible to be completed. RTTI is the key to conquer this problem. Although a great deal of importance is attached to RTTI, many C++ programmers are still confused by RTTI realization. In this paper, a concrete RTTI is realized, and it gives C++ programmers a chance to have a glimpse of RTTI realization. 

Key words: RTTI, dynamic_cast, persistence