Inheritance Part V; Heaps
Channel:
Subscribers:
2,640
Published on ● Video Link: https://www.youtube.com/watch?v=Ai8CEgP9owo
Did a little bit more on inheritance today, showing how to get the typeid of classes (or manually making an id() method to tag classes) and how to call functions specifically on a child class when you only have a pointer to a parent class.
You can either call a virtual method on the parent that is overloaded on the child to call the child-specific function, or you can use the typeid information to downcast from a base class to a child class and then call the child-specific method on it.
We then introduced Heaps, which are like BSTs, except they are sorted vertically instead of horizontally, and have different uses. They're optimized for finding the maximum (for max heaps) or minimum value (for min heaps) in a data structure.
Other Videos By Bill Kerney
Tags:
csci 41
heaps
inheritance
downcasting
c++
typeid
rtti