dynamic cast questions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • puzzlecracker

    #1

    dynamic cast questions



    What about dynamic_cast when dynamic reference is not unique (e.g. A-
    >B, B->C, B->D, is dynamic_cast<B *correct for pointer to D?
    Why would you use dynamic cast<void *>?

    What is typeid & what does it return? How would you use it?

    What is wrong here

    void *pVoid = new C(); C *pC = dynamic_cast<C *(pVoid);
  • Jeff Schwab

    #2
    Re: dynamic cast questions

    puzzle cracker wrote:
    >
    What about dynamic_cast when dynamic reference is not unique (e.g. A-
    >B, B->C, B->D, is dynamic_cast<B *correct for pointer to D?
    >
    Why would you use dynamic cast<void *>?
    >
    What is typeid & what does it return? How would you use it?
    >
    What is wrong here
    >
    void *pVoid = new C(); C *pC = dynamic_cast<C *(pVoid);
    Where have you actually seen any of these constructs? This smells like
    homework.

    Comment

    • Obnoxious User

      #3
      Re: dynamic cast questions

      On Sat, 27 Sep 2008 08:42:41 -0700, puzzlecracker wrote:
      What about dynamic_cast when dynamic reference is not unique (e.g. A-
      >>B, B->C, B->D, is dynamic_cast<B *correct for pointer to D?
      >
      Why would you use dynamic cast<void *>?
      >
      What is typeid & what does it return? How would you use it?
      >
      What is wrong here
      >
      void *pVoid = new C(); C *pC = dynamic_cast<C *(pVoid);
      Why don't you try google for it? Most of the time
      that's a pretty fast way to get information and
      answers.

      --
      OU
      Remember 18th of June 2008, Democracy died that afternoon.

      Comment

      • puzzlecracker

        #4
        Re: dynamic cast questions

        On Sep 27, 11:50 am, Jeff Schwab <j...@schwabcen ter.comwrote:
        puzzle cracker wrote:
        >
        What about dynamic_cast when dynamic reference is not unique (e.g. A-
        B, B->C, B->D, is dynamic_cast<B *correct for pointer to D?
        >
        Why would you use dynamic cast<void *>?
        >
        What is typeid & what does it return? How would you use it?
        >
        What is wrong here
        >
        void *pVoid = new C(); C *pC = dynamic_cast<C *(pVoid);
        >
        Where have you actually seen any of these constructs? This smells like
        homework.
        lazy to google it, I found these guys at c++ trivia forum, I actually
        have lots more of this intricate questions.

        Not really in the need of solutions, just wanted you guys to see c++
        from the unknown angle...

        Comment

        • Obnoxious User

          #5
          Re: dynamic cast questions

          On Sat, 27 Sep 2008 09:46:04 -0700, puzzlecracker wrote:
          On Sep 27, 11:50 am, Jeff Schwab <j...@schwabcen ter.comwrote:
          >puzzle cracker wrote:
          >>
          What about dynamic_cast when dynamic reference is not unique (e.g. A-
          >B, B->C, B->D, is dynamic_cast<B *correct for pointer to D?
          >>
          Why would you use dynamic cast<void *>?
          >>
          What is typeid & what does it return? How would you use it?
          >>
          What is wrong here
          >>
          void *pVoid = new C(); C *pC = dynamic_cast<C *(pVoid);
          >>
          >Where have you actually seen any of these constructs? This smells like
          >homework.
          >
          lazy to google it, I found these guys at c++ trivia forum, I actually
          have lots more of this intricate questions.
          >
          Not really in the need of solutions, just wanted you guys to see c++
          from the unknown angle...
          What unkown angle?

          Are you trolling now?

          --
          OU
          Remember 18th of June 2008, Democracy died that afternoon.

          Comment

          • James Kanze

            #6
            Re: dynamic cast questions

            On Sep 27, 6:28 pm, Obnoxious User <O...@127.0.0.1 wrote:
            On Sat, 27 Sep 2008 08:42:41 -0700, puzzlecracker wrote:
            What about dynamic_cast when dynamic reference is not unique (e.g. A-
            >B, B->C, B->D, is dynamic_cast<B *correct for pointer to D?
            Why would you use dynamic cast<void *>?
            What is typeid & what does it return? How would you use it?
            What is wrong here
            void *pVoid = new C(); C *pC = dynamic_cast<C *(pVoid);
            Why don't you try google for it? Most of the time
            that's a pretty fast way to get information and
            answers.
            So is asking questions here. With the advantage that 1) you
            don't have to figure out how to enter your request (what
            keywords should he google for here), and 2) there's actually a
            reasonable chance that you get the right answer, and can
            recognize it as such.

            --
            James Kanze (GABI Software) email:james.kan ze@gmail.com
            Conseils en informatique orientée objet/
            Beratung in objektorientier ter Datenverarbeitu ng
            9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

            Comment

            • Hendrik Schober

              #7
              Re: dynamic cast questions

              James Kanze wrote:
              On Sep 27, 6:28 pm, Obnoxious User <O...@127.0.0.1 wrote:
              [...]
              >Why don't you try google for it? Most of the time
              >that's a pretty fast way to get information and
              >answers.
              >
              So is asking questions here. With the advantage that 1) you
              don't have to figure out how to enter your request (what
              keywords should he google for here), and 2) there's actually a
              reasonable chance that you get the right answer, and can
              recognize it as such.
              3) You might learn much more than just the answer to what you asked.

              4) So might we.

              Schobi

              Comment

              Working...