Hello , I always had a distant relationship with C++ (writing in it small programs (or libs for other languages) only when performance really matters) but I have found myself writing more and more C++ bots. I learned that you need to separate the definition of the class (interface in c++ ) in a hpp file with its implementation in a cpp file , but as i write more I got tired of that and now I implement my methods in the header hpp file .
I have tried to understand why this is not the way to do it but I still don't get it. Of course implementing the methods in a cpp file could give you the option to implement some of them in one file and some of them in another in the future but that would be a mess in my opinion.
Have I got this all wrong ?
jkon 636 Posting Whiz in Training Featured Poster
Recommended Answers
Jump to PostThis approach only works if your header is used in only one code file. If you have two code files using the same header then each compiled object file will have a complete set of functions in it. When the linker tries to create your binary executable file it will …
All 2 Replies
TerribleTadpole 30 Newbie Poster
AndreRet commented: Nice answer!! +15
jkon 636 Posting Whiz in Training Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.