I want to know that if i can define and declare methods/functions in a .h file and whether i could call them in a test file(.cpp file)or do i need just to declare in the .h file and the deine in a separte .cpp file.
Thanks i am coding in c++
I want to know that if i can define and declare methods/functions in a .h file and whether i could call them in a test file(.cpp file)or do i need just to declare in the .h file and the deine in a separte .cpp file.
Thanks i am coding in c++
You can declare and define functions in a header but defining them without making them inline might give you linking errors.The one definition rule is easy to break unless the functions are inline
in the latter case.
Unless, You really know what you are doing it is best to declare the functions in a header file and define them in a cpp file.