Suppose you have the following non-static member function:
struct C {
void f();
}
Now suppose you want to implement C::fusing some sub-functions specific to C::fto make it shorter and more readable; eg:
void C::f() {
h1();
h2();
hn();
}
Assume that many of these h () functions do not need access to any data items. This means that you can define functions as static free functions (in one .cpp) or as member functions (static or not).
Could you make them static free functions or members of a C function?
One advantage in the first case is that you do not need to declare them in C:
static void h1() {
static void h2() {
static void hn() {
, , , , .cpp( C:: f ).
C, , , C::f.
struct C {
void f();
private:
static void h1();
static void h2();
static void hn();
}
void C::h1() {
void C::h2() {
void C::hn() {
, , , -, C::f, .