dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


advertisement
 

Use RTTI for Dynamic Type Identification

Runtime Type Information (RTTI) was created more than a decade ago, yet most developers remain unaware of its functions and benefits. This month's solution explains when and how you can use RTTI for dynamic type detection.


advertisement

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


++ creators introduced Runtime Type Information (RTTI) more than a decade ago. Yet even today many programmers arent fully aware of its benefits and perils. In the following sections, I will show when and how you should use RTTI.



Object-oriented pundits claim that with a proper design and judicious use of virtual member function, you won't need to use RTTI. However, under certain conditions, for example, when using heterogeneous containers and root-based class hierarchies (MFC for example), dynamic type detection is sometimes unavoidable. How can you detect an objects dynamic type?



Use the built-in RTTI operators typeid and dynamic_cast.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date