Virtual Functions in C++

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


Рекомендации по теме
Комментарии
Автор

There's no such thing as "minimal impact" in my opinion, there's impact or no impact. I'd rather avoid impact altogether. :P

greob
Автор

For the newcomers, my suggestion would be to watch "stack vs heap memory in C++", "how to create/instantiate objects in c++" and "the new keyword in c++" before watching this.

milenkopizdic
Автор

Brief explanation of uncovered topics (yet) in this video:
Since strings is not a primitive type of C++ we need to import the header
#include <string>
To use string without namespace std is like this:
std::string MyString("hello")
This is equivalent to:
std::string MyString = "Hello"

Pointer instances:
new keyword returns a pointer
std::string* MyString = new std::string("Hello")
And if is a pointer you access their properties with -> instead of a dot (.)
std::cout << MyString->length() << std::endl;

JuanPabloOrtizYax
Автор

My English captions: "my name is HMO and welcome back to my syphilis gloss series".

luisantonioreyes
Автор

By far the best channel on youtube to learn anything about c++! Thanks a lot cherno!

raoulbrigola
Автор

Guests: That's a very nice sofa, how comfy is it to sit on..?
Cherno: No, it's just for the Aesthetics, I sit on the ground.

hamza.abdullah
Автор

Beautiful set of tutorials. Probably the best I've seen so far for any programming language. 

I also like how it is divided into the different episodes that you can watch whenever you are only interested in a specific topic.

Thank you for your time and please keep going like this!

nilsmelchert
Автор

Figured id give you a thumbs up your 30 second explanation of what a virtual function does explained what my teacher could not do in 2 hours. Appreciate it sir.

undeadguy
Автор

Most of the time I've seen a tutorial about virtual functions/vtables it works pretty well to make some diagrams on paper about how it works because it's such an abstract concept that in general people, especially newbies, find a hard time trying to understand what's happening under the hood.

FranciscoCrespoOM
Автор

You are the best Cherno. I am visiting your c++ series regularly. Basically when I run into a concept I need to get familiar with on the go :D

jonnyreh
Автор

Virtual functions at first seemed harder than pointers for me... You've simplified it so elegantly... Thank you :)

jonathangerard
Автор

To better understand his code, go through these topics first:
1. String Class
2. Initialisation list
3. Arrow Operator
4. New keyword

MilindNikose
Автор

This is short and beautiful, man! Please, continue doing what you do now

work
Автор

What is the difference between

Player(const std::string& name):m_name(name) {}

and

Player(const std::string& name) {
m_name = name;
}
Is it some kind of syntactic sugar?

TheSunscratch
Автор

Please make a video on V Table and Memory allocation. I have been watching C++ playlist, your videos are very good to get concepts more clear.

yugantkadu
Автор

Very nice explanation. Short and right to the point. It's easy to agree with your assessment that v-tables have such minimal cost that the inconvenience of not using them makes using them a no-brainer. Thank you very much!

RossYlitalo
Автор

1. Virtual function: declared in the base class, which enables the derived object to use its override function.
2. Override: declared after the function in the derived class. not required, but avoid misspelling the function name or overriding the non-virtual function in the base class.
3.V Table : stores the virtual function in the base class to dispatch, which cost space, int * pointer to the override function.
4. in specific embedded systems, using v table might impact the performance .

LunaFlahy
Автор

It is the luckiest moment in this year that i found these series right after i started learning cpp

michaelkane
Автор

Haha loving the "is he going to be in focus or not?" game I'm playing watching through these videos 😂 such an epic series though mate, thanks!

xbitbybit
Автор

Dude you are great at explaining these things. Probably won't ever see this comment but thank you. I don't write comments a lot but I am teaching myself c++ and I've watched several of your vids and they are awesome and extremely helpful. Thanks again!

thomashaug