Home Segments Index Top Previous Next

709: Sidetrip

Note, however, that the C++ compiler is committed only to try to compile internally defined member functions as inline functions. If an internally defined member function is deemed too complex for the C++ compiler to compile, the C++ compiler actually, incredibly, produces a distinct version of the member function each time that the class definition reappears. If a header file contains such a class definition, and if that header file is included in 10 files, then 10 identical versions of the member function are compiled. Because a distinct function is produced each time that the function definition is encountered in an included header file, there is—in a certain convoluted sense—no violation of the rule that each function definition must appear only once.