When you have inline definitions of functions in the header file, and you want to move the the function definition bodies out of the header and into a .cpp file, you can't just cut-and-paste the functions as they were defined in the header; you have to convert the syntax from this:
class Foo
{
void method1() { definition(); }
void method2() { definition(); }
void method3() { definition(); }
};
To this:
void Foo::method1() { definition(); }
void Foo::method2() { definition(); }
void Foo::method3() { definition(); }
Edit: Just wanted to point out that what I'm hoping to avoid is having to type the class name in front of every method name. It may seem like a small thing but when you're moving a lot of function definitions out of the header and into the cpp file, it adds up. And when the return type is especially complicated, you have to find where in the line each return type ends and each method name begins.
So my question is, do I have to do it like that second block of code above? What if I did this (is the following standards compliant C++?):
In Foo.h:
class Foo
{
void method1();
void method2();
void method3();
};
In Foo.cpp:
#include "Foo.hpp"
class Foo
{
void method1() { definition(); }
void method2() { definition(); }
void method3() { definition(); }
};