In this chapter, we explored how to write pure functions in C++. Since there are a few tricks that you need to remember, here's a list of the recommended syntax:
- Class functions for pass by value:
-
static int increment(const int value)
-
int increment(const int value) const
-
- Class functions for pass by reference:
-
static int increment(const int& value)
-
int increment(const int&value) const
-
- Class functions for pass pointer by value:
-
static const int* increment(const int* const value)
-
const int* increment(const int* const value) const
-
- Class functions for pass pointer by reference:
-
static const int* increment(const int* const& value)
-
const int* increment(const int* const& value) const
-
- A standalone function for pass by value: int increment(const int value)
- A standalone function for pass by reference: int increment(const int&...