Learn to Code via Tutorials on Repl.it

← Back to all posts
C++ Ploymorphism - The Good Stuff
Giothecoder (127)

Now that you know about polymorphism and so implementation, let’s finish up with the inheritance thing..

Ok
So
You must be thinking
“This vector is absolutely useless, you can’t even do anything if you don’t know the type of the class!”

Well.
Yes.
Your right.
It’s absolutely useless as it is.
So, introducing the awesome, world changing...

Virtual function!! :)

So, just to be clear, all non private data is inherited by child classes, meaning that functions also are inherited. As an example, let’s look at

WIP