Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio
  4. Dynamic cast problem

Dynamic cast problem

Scheduled Pinned Locked Moved Visual Studio
debugginghelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Abyss
    wrote on last edited by
    #1

    I migrated my project to VC2005 and found a pretty strange problem. The code tries to dynamic cast an object and the result is NULL even the objet type is valid. E.g. I have a following code: class A; A* ptr = new A; ... A* pTest = dynamic_cast(ptr); pTest is NULL but in the debugger I can see that "ptr" is A. The project has RTTI enabled. Any idea what could be the problem? Thanks, Abyss

    K 1 Reply Last reply
    0
    • A Abyss

      I migrated my project to VC2005 and found a pretty strange problem. The code tries to dynamic cast an object and the result is NULL even the objet type is valid. E.g. I have a following code: class A; A* ptr = new A; ... A* pTest = dynamic_cast(ptr); pTest is NULL but in the debugger I can see that "ptr" is A. The project has RTTI enabled. Any idea what could be the problem? Thanks, Abyss

      K Offline
      K Offline
      Kurt _B
      wrote on last edited by
      #2

      Why are you casting to the same type?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups