You leave ads in the header file:
class A2DD { private: int gx; int gy; public: A2DD(int x,int y);
And put the definitions in the implementation file.
A2DD::A2DD(int x,int y)
You can mix the two (leave the getSum() definition in the header, for example). This is useful, as it gives the compiler a better chance of inlining, for example. But it also means that a change in implementation (if left in the header) may result in a rebuild of all other files containing the header.
Please note that for templates you need to save everything in the headers.
Mat Mar 06 2018-12-12T00: 00Z
source share