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.

further reading

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

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

Bubble Sort Manually a Linked List in Java -

asp.net mvc - SSO between MVCForum and Umbraco7 -