cppannotations/yo/first/dynamiccast.yo
2009-10-20 07:54:32 +00:00

8 lines
545 B
Text

Finally there is a new style cast that is used in combination with
polymorphism (see chapter ref(POLYMORPHISM)). Its syntax is:
centt(dynamic_cast<type>(expression))
It is used run-time to convert, a pointer to an object of a class to a
pointer to an object of a class that is found further down its so-called
em(class hierarchy) (which is also called a em(downcast)). At this point in
the em(Annotations) a tt(dynamic_cast) cannot yet be discussed extensively,
but we will return to this topic in section ref(DYNAMICCAST).