I am reading my book's section on headers and I don't really understand why we need to have two files when needing to call a header in a main function...like class.h and then a cpp file for class. Why can't we just put it all in class.h?? :S
I know this is probably a really silly question but I'm super confused!!
well firstly, you cant have functions in a header, and if you want to define the methods for a class declared in a .hpp file you can do that (which i like since it looks cleaner)
Uhm, I believe you can define functions in a header file. Its just not recommended because if you change the logic you have to recompile every file that relies on that header.