Hi guys I have a vehicule.h header file like this
#include <iostream>
using namespace std;
class Vehicule{
private:
string type;
//etc...
};
//can this function be there or do i need to add it on .cpp file?
int main(){
return 0;
}
CodePudding user response:
Technically yes, you can. However, if you do put a non-inline function definition such as main
into a header, then you may only include the header into one translation unit. This makes the header rather pointless. In conclusion, don't do it because it isn't useful.