Dynamic Binding (Polymorphism) With The Virtual Keyword | C++ Tutorial

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

This was such a boon to find. I've been lurking for a while since starting school for computer science. You've really been a help, thanks for explaining so many topics!

FluxSentor
Автор

Would you only need to apply the virtual keyword to the base class member function? Or are there cases in which you would need to apply it to derived class member functions?

CrabRango
Автор

Thanks! I thought that polymorphism just meant that the derived class could be used to access member functions and variables of the parent class. So, in our array with student object pointers, when we create space for medical student object instances, is space for all the member variables of medical student allocated or just the name variable? Thanks! Also, if a function returns a reference to something like "&int add()", just returning an int in the actual function's code is enough right? The compiler will convert the returned int to an int reference, right?

ValliNayagamChokkalingam
Автор

This is the best video on static and dynamic polymorphism I have seen among here on YT

dwivedys
Автор

if I have a chain of drive class like a semi-diamond and the very bottom class has the base class 3 times do I have to use virtual in all the drived class?

shafayet
Автор

why polymorphism does not work if I make the array on the stack instead of on the heap?

shafayet
Автор

Your videos on OOP topics help me a lot.

MohitRaj-
Автор

So basically what the virtual keyword does is override the default behavior of a base class function so when polymorphism is in place child clases use their own versions?

germankoga