Click here to Skip to main content
15,914,162 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCD Writer Pin
4-Feb-02 20:07
suss4-Feb-02 20:07 
GeneralRe: CD Writer Pin
alex.barylski4-Feb-02 20:57
alex.barylski4-Feb-02 20:57 
General_cast<>'s Pin
Jamie Nordmeyer4-Feb-02 18:43
Jamie Nordmeyer4-Feb-02 18:43 
GeneralRe: _cast<>'s Pin
Christian Graus4-Feb-02 19:17
protectorChristian Graus4-Feb-02 19:17 
GeneralRe: _cast<>'s Pin
Joaquín M López Muñoz4-Feb-02 19:53
Joaquín M López Muñoz4-Feb-02 19:53 
GeneralRe: _cast<>'s Pin
Michael Dunn4-Feb-02 21:08
sitebuilderMichael Dunn4-Feb-02 21:08 
GeneralRe: _cast<>'s Pin
Joaquín M López Muñoz4-Feb-02 21:24
Joaquín M López Muñoz4-Feb-02 21:24 
GeneralRe: _cast<>'s Pin
Chen Venkataraman5-Feb-02 4:23
Chen Venkataraman5-Feb-02 4:23 
Joaquín M López Muñoz wrote:
dynamic_cast<> plays a role similar to that of static_cast<> when downcasting from a base class to a derived one, but it has the important difference that the downcasting is checked for validity at run-time, ie. dynamic_cast<> returns 0 if what you are trying to downcast to say A* is not actually a A*. For this to work, classes passed to dynamic_cast<> must be polymorphic, ie. they must have at least one virtual function.

Just want to add that dynamic_cast can be used for references also but in this case if the cast fails, it will throw a bad_cast exception (because there is no such thing as a bad reference)

Here's a link that explains the various casts in more detail: http://www.gotw.ca/gotw/017.htm



Chen Venkataraman
GeneralRe: _cast<>'s Pin
Jamie Nordmeyer5-Feb-02 5:46
Jamie Nordmeyer5-Feb-02 5:46 
GeneralODBC Access Reports Pin
4-Feb-02 17:56
suss4-Feb-02 17:56 
GeneralRe: ODBC Access Reports Pin
Mazdak4-Feb-02 20:23
Mazdak4-Feb-02 20:23 
GeneralRe: ODBC Access Reports Pin
anju5-Feb-02 4:44
anju5-Feb-02 4:44 
QuestionDoes anyone here do code correction? Pin
4-Feb-02 17:24
suss4-Feb-02 17:24 
AnswerRe: Does anyone here do code correction? Pin
alex.barylski4-Feb-02 20:53
alex.barylski4-Feb-02 20:53 
General774 Pin
4-Feb-02 17:22
suss4-Feb-02 17:22 
GeneralRe: 774 Pin
Christian Graus4-Feb-02 17:43
protectorChristian Graus4-Feb-02 17:43 
GeneralRe: 774 Pin
4-Feb-02 18:01
suss4-Feb-02 18:01 
GeneralRe: 774 Pin
Jon Hulatt4-Feb-02 23:23
Jon Hulatt4-Feb-02 23:23 
GeneralC2100 Pin
4-Feb-02 16:15
suss4-Feb-02 16:15 
GeneralRe: C2100 Pin
Le centriste4-Feb-02 16:31
Le centriste4-Feb-02 16:31 
Questionhow do you compile? Pin
4-Feb-02 15:19
suss4-Feb-02 15:19 
AnswerRe: how do you compile? Pin
Christian Graus4-Feb-02 16:31
protectorChristian Graus4-Feb-02 16:31 
GeneralRe: how do you compile? Pin
Jon Hulatt4-Feb-02 23:28
Jon Hulatt4-Feb-02 23:28 
GeneralAnother string / buffer question Pin
Tom Wright4-Feb-02 12:35
Tom Wright4-Feb-02 12:35 
GeneralFont size and ISAPI Pin
Guillaume F.4-Feb-02 12:11
Guillaume F.4-Feb-02 12:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.