Featured

C++ Casting - Part 4 - static_cast vs dynamic_cast (Interview Question)



Published
►Full C++ Series Playlist: https://www.youtube.com/playlist?list=PLvv0ScY6vfd8j-tlhYVPYgiIyXduu6m-L
►Find full courses on: https://courses.mshah.io/
►Join as Member to Support the channel: https://www.youtube.com/channel/UCA64pZbN5Mz5NxC3SO4qpDg/join

►Lesson Description: In this lesson I give you one of my interview questions on static versus dynamic casts. See how you'd answer, and watch my review of our previous lesson! Again, my recommendation is to try to avoid casting when you can, and I would probably default to more 'safe' casts (i.e. dynamic_cast), so hopefully this video will help you understand why. For this particular lesson, I think it's important to try the code, and play around with it like I did, so you can see where the casts 'might work' (i.e. compile) -- but in many cases give you the wrong behavior!

►YouTube Channel: https://www.youtube.com/c/MikeShah
►Please like and subscribe to help the channel!
Category
Job
Be the first to comment