Dynamic polymorphism
2 posters
Page 1 of 1
Dynamic polymorphism
Dynamic polymorphism
[edit]Inheritance
Variable pointers (and references) to a base class type in C++ can refer to objects of any derived classes of that type in addition to objects exactly matching the variable type. This allows arrays and other kinds of containers to hold pointers to objects of differing types. Because assignment of values to variables usually occurs at run-time, this is necessarily a run-time phenomenon.
C++ also provides a dynamic_cast operator, which allows the program to safely attempt conversion of an object into an object of a more specific object type (as opposed to conversion to a more general type, which is always allowed). This feature relies on run-time type information (RTTI). Objects known to be of a certain specific type can also be cast to that type with static_cast, a purely compile-time construct which is faster and does not require RTTI.
Cartier Tank Francaise Ladies Watch replica
Home improvement
meodingu- Member
- Number of posts : 307
Registration date : 2010-09-28
Re: Dynamic polymorphism
C++ also provides a dynamic_cast operator, which allows the program to safely attempt conversion of an object into an object of a more specific object type (as opposed to conversion to a more general type, which is always allowed). This feature relies on run-time type information (RTTI). Objects known to be of a certain specific type can also be cast to that type with static_cast, a purely compile-time construct which is faster and does not require RTTI.
stevenlee- Member
- Number of posts : 2
Registration date : 2011-10-18
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum