c++ - Passing MyClass defined in header as function argument to other file -
i've spent around hour , couldn't find helpful on web. problem i've got files a.h, b.h, a.cpp, b.cpp , main.cpp. in a.h i've got declared container attributes defined myself. pass container , argument function in b.h/b.cpp. way of doing this?
a.h file
struct container{ int size; int* array ...}; b.cpp
void somefunction(container container) {...} thanks help.
use #include "file" include files need.
for example in b.cpp:
#include "a.h" void somefunction(container container); you should put include guards header files. prevent unwanted multiple inclusion of same file. if file called a.h, write following:
a.h :
#ifndef a_h #define a_h // ... code ... #endif // a_h
Comments
Post a Comment