We had already constructs like
{}
class Node {
...
double x() { return xCoord_ ;}
};
One can put arbitrary functions here, e.g.
{}
class Node {
...
intersectionLogic() {
// lots of stuff
}
};
This is called a method of the class. This version is the ``inlined''
version of the method.
Often, this gets so long that one wants to have this outside the class definition. In this case one would write:
{}
class Node {
...
intersectionLogic() ;
};
and somewhere else
{}
Node::intersectionLogic() {
// lots of stuff
}
Conventionally, one would put the first part into a *.h file,
and the second part into a *.cpp file. It is however also
possible to leave everything in work.cpp.
Inlined functions/methods are faster during the execution but need more memory and more compilation time.