Uploaded image for project: 'OpenSAML - C++'
  1. OpenSAML - C++
  2. CPPOST-43

A dynamic_cast question...please explain

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Blocker
    • Resolution: Invalid
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: SAML 2
    • Labels:
      None
    • Operating System:
      Other
    • CPU Type:
      Other
    • C/C++ Compiler:
      Other

      Description

      compiled opensaml-2.3 c++ library on my machine and I am curious about this usage:

      Say, class "Issuer" is derived from class "XMLObject"

      auto_ptr<XMLObject> xo(unmarshallElement(singleElementFile));
      Issuer* issuer = dynamic_cast<Issuer*>(xo.get());

      "xo" is of type "XMLObject" the base class so it is having the instance of the base class

      this means the dynamic_cast will always fail

      it will only work if "xo" points to an instance of "Issuer" already, which is not the case here....so how doe this work?

      Does "xo" the base class pointer hold an instance of "Issuer" ?

        Attachments

          Activity

            People

            Assignee:
            cantor.2@osu.edu Scott Cantor
            Reporter:
            kanyaraj Kanyaraj Babu
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: