Is it considered bad practice to have an .hpp and a .cpp file

by einpoklum   Last Updated September 08, 2017 12:05 PM

I have a class whose basic usage is covered by inline-defined methods in its definition. But - some functionality requires a .cpp (to include headers I don't want everyone having to include, to avoid repeated compilation etc.)

Is it acceptable practice for me to put my class in an .hpp file and the compilation-necessitating code in a .cpp file?



Answers 1


It's normal practice. I would suggest only the code that must go in the .hpp be in the .hpp and everything else go in the .cpp.

Caleth
Caleth
September 08, 2017 12:02 PM

Related Questions


Human names in programming examples

Updated April 20, 2015 22:02 PM


Should I avoid using spaces in my filenames?

Updated August 18, 2017 20:05 PM

Class name for methods getting data

Updated February 06, 2018 13:05 PM