C++ Casting - Part 3 - static_cast and dynamic_cast (mega lesson) | Modern Cpp Series Ep. 94

preview_player
Показать описание

►Lesson Description: In this lesson I talk about the four keywords that were added to C++ 11, focusing primarily on static and dynamic cast. These named casts are generally more safe to use, easier to grep for, and can help you cast your data more safely when you absolutely must cast your data. I'll walk through several examples with a class hierarchy, and hopefully convince you that the named casts better show your intent of the code, and are much better than the C-style cast (which essentially is trying all of these named casts).

►Please like and subscribe to help the channel!
Рекомендации по теме
Комментарии
Автор

GOD he is such a GREAT teacher - GOD DAMN ALL MY PROFESSORS !!!

mbaceo
Автор

Before I watched this video, I was acting like the C-Style cast does: Keep trying stuff until something works. "oops, this compiler/program didn't like this one, lets try the next!". Another great video!

Would also love if you mentioned std::static_pointer_cast and dynamic_pointer_cast with smart pointers in a subsequent video.

tomw
Автор

great explanation thank you so much
please continue, we need more in depth tutorials

sallaklamhayyen
Автор

I did not know that C-style casts, and the other types of casts even existed.😅
Thanks Mike!

jrohit
Автор

hallo Mike, we love to see the two other cast.
Regards

blaisofotso
Автор

Hi Mike, why do you recommend using dynamic_cast to handle pointers and references at 30:39. It seems like static_cast works with pointers and references too, at around 20:00.

kenk