@@hristovalev2923 cheers! It's probably somewhere in the C++ Programming language book or other texts otherwise. I learned about it from a cppcon talk several years ago 🙂
If I have a virtual base class, say Actor, that has two float vars---position_x and position_y---will the value of those vars be identical between all derived classes? For example, we have a Player class and an Enemy class, and both derive from the Actor class . . . are their position variables going to be identical and every actor just ends up on top of each other, or can they be unique to each instance of Actor? I guess a better way to ask it would be, are virtual class members static or not? I hope that makes sense lol.
I think I understand the question :) Each instance of the derived class will have different copies of the member variables -- that includes the derived class and any base classes it inherits from. The exception you've identified however, is that if you have 'static' member variables, then those are shared across all instances of base or derived classes.
This is literally the ONLY correct AND full explanation of the diamond problem on TH-cam
@@hristovalev2923 cheers! It's probably somewhere in the C++ Programming language book or other texts otherwise. I learned about it from a cppcon talk several years ago 🙂
brilliant as always = thank you so much❤
Cheers!
Superb Explanation. Thanks a lot Mike for visual investigation about virtual keyword behavior.
Cheers!
Excellent. Very wonderfully explained as always. Thank you.
Cheers, thank you Dhanush!
very good.
thanks
Cheers!
For the nth time, can’t get enough
Thanks Prof MS
Cheers Joe!
You beat everyone on youtube on this topic!!!💘🙏
Cheers 🥂
The best !!
Cheers!
Thanks for the fantastic video series Mike!
You are most welcome!
Nice, thank you!
Cheers!
If I have a virtual base class, say Actor, that has two float vars---position_x and position_y---will the value of those vars be identical between all derived classes? For example, we have a Player class and an Enemy class, and both derive from the Actor class . . . are their position variables going to be identical and every actor just ends up on top of each other, or can they be unique to each instance of Actor? I guess a better way to ask it would be, are virtual class members static or not? I hope that makes sense lol.
I think I understand the question :)
Each instance of the derived class will have different copies of the member variables -- that includes the derived class and any base classes it inherits from.
The exception you've identified however, is that if you have 'static' member variables, then those are shared across all instances of base or derived classes.
@@MikeShah Got it, thanks! That's gonna save me a lot of code. :D
What an excellent content!!!
Thank you for the kind words :) !