CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    10

    What is <dynamic_cast>

    The &lt;dyanmic_cast&gt; and &lt;static_cast&gt; are MACROS rite??
    I want the listing of this...
    Or else i want its functionality....I want that how it actually type casts the thing.....
    Please help me...
    Thanks
    Anand


  2. #2
    Join Date
    May 1999
    Location
    Seattle, WA USA
    Posts
    423

    Re: What is <dynamic_cast>

    dynamic_cast & static_cast are operators, not macros.

    static_cast & dynamic_cast simply cast the desired object to the desired type. dynamic_cast, however, is able to perform some runtime checking and will return NULL if the desired object cannot be cast to the desire type--static_cast will always cast it, regardless of whether or not it makes sense (this could be dangerous). Because the static_cast does not do type checking, it is more dangerous to use, but it is also faster. So if you know what you are casting is okay, then use static_cast.

    --michael


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured