O'Reilly logo

Financial Instrument Pricing Using C++, 2nd Edition by Daniel J. Duffy

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 3Modelling Functions in C++

3.1 Introduction and Objectives

In this chapter we introduce various ways to define and use functions in C++. A function is a mathematical concept and the goal of this chapter is to show how to realise this concept in C++ from the viewpoint of the procedural, object-oriented and functional programming models. Having done that, we examine how to apply these capabilities to designing and implementing flexible software. Up to the present time it is safe to say that many C++ applications make extensive use of function pointers, overloaded functions and subtype polymorphism. In this chapter we discuss how similar functionality can be achieved by using the new functionality in C++. We shall show how to achieve the same (or better) level of flexibility using constructs based on generic and functional programming models.

Much of the material in this chapter is relatively new because it is part of C++11. Furthermore, it may require some effort to learn by developers who have become accustomed to writing applications based on the object-oriented and procedural programming models. For example, we shall see that it is possible to create loosely coupled software systems based on signature-oriented function definitions. In particular, the resulting functionality will allow us to implement a number of software connection architectures based on object-oriented, interface and plug-and-socket architectural models.

In one sense, this chapter could be seen as ...

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