C++ Tutorial: Dynamic and Static binding example

preview_player
Показать описание
In this short video, I demonstrate dynamic and static binding in a short program.

// Consider supporting this channel in multiple ways
Bitcoin: 177wfkQwzXiC8o2whQMVpSyuWUs95krKYB
Рекомендации по теме
Комментарии
Автор

It’s worth pointing out that that functions of derived classes don’t need to have the virtual keyword in order to override functions of base classes. It’s also a bit redundant in this case since we're overriding a function and overrides of virtual functions are always virtual.

jamesteow
Автор

I finally got it after watching your video. Thank you, Professor Hank!

erikchen
Автор

Does bar::print() also need to be virtual for this to work or do we only need foo::print() to be virtual? By setting bar::print() to be a virtual function are we just implementing good practices, in case we decide that bar is also going to be a base class for some derived class?

MyFightMoney