O'Reilly logo

Discovering Modern C++: An Intensive Course for Scientists, Engineers, and Programmers by Peter Gottschling

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Object-Oriented Programming

C++ is a multi-paradigm language, and the paradigm that is most strongly associated with C++ 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 function calls.

We will explain this in more detail within this chapter.

On the other hand, inheritance ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required