Chapter 6

Object-Oriented Programming

“We inherit nothing truly, but what our actions make us worthy of.”

—George Chapman

C++ is a multi-paradigm language, and the paradigm that it is most strongly associated with is Object-Oriented Programming (OOP). As a result, we find all these beautiful dog-cat-mouse examples in books and tutorials. Experience shows, however, that most real software packages do not contain such deep class hierarchies as the literature makes us believe. It is furthermore our experience that generic programming is the superior paradigm in scientific and engineering programming because:

  • It is more flexible: polymorphism is not limited to sub-classes; and

  • It provides better performance: no overhead in indirect function calls. ...

Get Discovering Modern C++, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.