CppCon 2019 has ended
Back To Schedule
Friday, September 20 • 10:30 - 11:30
Polymorphism != Virtual: Easy, Flexible Runtime Polymorphism Without Inheritance

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Many C++ programmers, automatically think of virtual when they hear 'polymorphism'. However, there are better, more flexible ways to have polymorphism without using virtual. This talk will show how to achieve that.

We will start by looking at static and runtime polymorphism and discuss the advantages and disadvantages of each. Then we will take a look at 'virtual', looking at how it is implemented and the disadvantages of inheritance based polymorphism it entails.

With that background in place, we will demonstrate a technique using C++17 that combines some of the best features of static and runtime polymorphism without using inheritance while still being easy to use.

If you ever watched Sean Parent's talk "Inheritance Is The Base Class of Evil" and wanted an easier way to achieve what he achieved without the boilerplate, this talk is especially for you!

avatar for John Bandela

John Bandela

Software Engineer, Google
I first started programming in C++ at age 14 in 1994 when I cajoled my parents into buying me Visual C++ 1.0 for my birthday. It took a while, but as I learned the language, I decided I really liked C++. I attended the University of Florida and obtained my undergraduate degree in... Read More →

Friday September 20, 2019 10:30 - 11:30 MDT
Aurora A
  • Type Design