Alternative implementation syntaxes for class members on c++ -


when declaring , implementing class or struct in c++ do:

h file

namespace space{   class something{     void method();   } } 

cpp file

void space::something::method(){   //do stuff } 

or

namespace space{   void something::method(){     //do stuff   } } 

note how possible wrap implementations inside namespace block don't need write space:: before each member. is there way wrap class members in similar way?

please note want keep source , header file separated. that's practice.

you can not if keep .cpp file.

otherwise, can, dropping .cpp file.

in .h file, have:

namespace space{   class something{     void method()     {       //method logic     }   }; } 

except, know, there limitations include header.

i'm not sure you, op, seem know you're doing, i'll include future users of question:

what should go .h file?


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -