03.12.2012 Views

C++ for Scientists - Technische Universität Dresden

C++ for Scientists - Technische Universität Dresden

C++ for Scientists - Technische Universität Dresden

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

208 CHAPTER 7. EFFECTIVE PROGRAMMING: THE POLYMORPHIC WAY<br />

Behind the Dynamic Polymorphism in <strong>C++</strong><br />

A programmer must be aware of the fact, that inheritance is one of the<br />

strongest bonds between objects. In real-world examples, few problems can<br />

be modeled successfully by class-inheritance only. The coupling by inheritance<br />

should be used very carefully.<br />

The advantages of this paradigm are:<br />

• Library: Data-types can be enhanced greatly.<br />

• Abstract algorithms with polymorphism enable greater code reusability compared to the<br />

procedural paradigm.<br />

• Strong binding of data structures and methods: Logical connections can be modeled easily.<br />

Logical errors can be detected easily.<br />

The disadvantages of this paradigm are:<br />

• The binary-method problem (see Section 7.5.3)<br />

• Bad optimization capability of a compiler due to the subtyping polymorphism (see Section<br />

??)<br />

• Strong binding of data structures and methods: Only usable on object-oriented problems.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!