how to implement dynamic_cast???

Discussion in 'C++' started by kuangye, Jun 8, 2008.

  1. kuangye

    kuangye Guest

    Hi all.

    Is there any document/paper/book that discus about how to implement
    dynamic_cast.....
     
    kuangye, Jun 8, 2008
    #1
    1. Advertising

  2. On 2008-06-08 10:30, kuangye wrote:
    > Hi all.
    >
    > Is there any document/paper/book that discus about how to implement
    > dynamic_cast.....


    Are you trying to implement your own C++ compiler?

    This is kind of off-topic but I do not know of a better place to ask.

    I think that dynamic_cast is usually implemented by looking at the
    objects vtable pointer, if it points to the type you are casting to then
    the cast succeeds. You also have to check if you are trying to cast to a
    subtype of the current object.

    --
    Erik Wikström
     
    Erik Wikström, Jun 8, 2008
    #2
    1. Advertising

  3. kuangye

    Fran Guest

    On Jun 8, 4:30 am, kuangye wrote:

    > Is there any document/paper/book that discus about how to implement
    > dynamic_cast.....


    You don't implement dynamic_cast, the compiler implements it. You
    just use it.
    --
    franl
     
    Fran, Jun 8, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. alg

    dynamic_cast<>

    alg, Jul 14, 2003, in forum: C++
    Replies:
    3
    Views:
    497
    Rolf Magnus
    Jul 14, 2003
  2. Dan Noland

    dynamic_cast and references

    Dan Noland, Jul 29, 2003, in forum: C++
    Replies:
    0
    Views:
    508
    Dan Noland
    Jul 29, 2003
  3. Yuming Ma
    Replies:
    1
    Views:
    726
    Jeff Schwab
    Dec 17, 2003
  4. Andreas Sch.

    typeid and dynamic_cast, gcc 3.3

    Andreas Sch., Jan 23, 2004, in forum: C++
    Replies:
    18
    Views:
    1,907
    Janusz Szpilewski
    Jan 29, 2004
  5. Jamie Burns
    Replies:
    11
    Views:
    9,093
    Nick Hounsome
    Jan 29, 2004
Loading...

Share This Page