We should be aware that there are serious performance penalties with using virtual functions and inheritance in C++. For example, a virtual function can be 20 times slower than an inline function. The rule is to never use a feature in c plus plus that you do not understand the implementation of fully.
Thanks tons for the comment. I am planning to do some more stuff with A.I. in the future, but haven't been able to get to it yet. It's on the stack of stuff though. In the meantime, I do have an A.I. play list I used for my classes at CSUEB. You can find some answers to your questions in those videos, at least implicitly.
You don't have to do so. I do so out of habit to remind me that it is a virtual function in case I want to use the class as a base class for other classes. Basically as a form of documentation. You absolutely don't have to though.
virtual keyword in a function within class means, that function can be overridden by its derived classes. const keyword after the function parameter within a class means the function can not modify its class members.
watching multiple of your videos in one sitting means hearing Foo, Rectangles, and squares a bunch. Love the videos, thank you!
Love that!
Thank for your teaching. I think your teaching is better our professor
Wow, thanks
Now this concept is my academic weapon for the OOP theory exam. Loved it
We should be aware that there are serious performance penalties with using virtual functions and inheritance in C++. For example, a virtual function can be 20 times slower than an inline function. The rule is to never use a feature in c plus plus that you do not understand the implementation of fully.
great explaination !!
thank you so much for this explanation of pure virtual functions!
Glad it was helpful!
thanks ,I found it an useful explaining simple video
Glad to hear that!
for the Bar class, would you not need to add keyword 'override' to add the implementation of the print() function?
It's a good idea to @override it, but not necessary. It would be better.
excellent videos, thanks so much :)
Glad you like them!
I wish you were my cs professor.
I wish I was my CS professor too. ;-)
Sometimes, bacon and eggs is just foo. 🙃Sometimes, its very tasty.
Nice class names!
😆🍻
Love your content hank, is there anyway you could use AI to show examples where it makes mistakes or why it's important to utilise it's advantages
Thanks tons for the comment.
I am planning to do some more stuff with A.I. in the future, but haven't been able to get to it yet. It's on the stack of stuff though.
In the meantime, I do have an A.I. play list I used for my classes at CSUEB. You can find some answers to your questions in those videos, at least implicitly.
so professor is this is the last oop video or there is a future playlist ? and thank you very much for these videos .
There's a whole play list. See the video description for the link.
🤔 When the derived class has to implement the abstract class’s pure virtual functions, what’s the point of having base class?
To ensure that all derived classes have a similar interface.
Hi! I don't understand why you made the print function virtual in the derived classes.
You don't have to do so. I do so out of habit to remind me that it is a virtual function in case I want to use the class as a base class for other classes. Basically as a form of documentation. You absolutely don't have to though.
Hmm never seen virtual functions and that const before
virtual keyword in a function within class means, that function can be overridden by its derived classes.
const keyword after the function parameter within a class means the function can not modify its class members.
@@velvethamster9809 what
@@hlubradio2318 ?