typeid and dynamic_cast implementation

Hi, as you see I'm having problems figuring out the implementation of these 2. I read on StackOverflow that compiler is doing this kind of stuff and some other resources suggests that linker is also involved.

So my question is can I actually implement typeid and dynamic_cast without touching compiler and linker? If I cant its weird that this exercise is in Stroustrups book "C++ Programming Language"!

These 2 functions are like a magic to me

EDIT : Ok its not that I have to implement dynamic_cast, its about making some system that works in similar way
Consider how dynamic_cast might be implemented. Define and implement a dcast template
that behaves like dynamic_cast but relies on functions and data you define only. Make
sure that you can add new classes to the system without having to change the definitions of
dcast or previously-written classes.

So its kind of my mistake!
Last edited on
Topic archived. No new replies allowed.