C++ Pass by reference with .h and .cpp files

I have a HUGE problem that is really putting a barrier between me, and development in C++. I understand pass by reference, But one thing I never seen explained is how to use it in classes(with header files) Just when I thought I was ready I ran into this problem. I'm going to have tons of variables and from what I understand pass by value isn't exactly "efficient" and pass by reference is what you do to pass variables to other functions and modify them without actually making a copy. So I've successfully done it before, But fail to pass, for example something I declare in main.cpp over to example.h and example.cpp.
Please leave an example with header files and explain in a brief paragraph how it is done.

Thanks a million

-bacondude95



Last edited on
Please leave an example with header files and explain in a brief paragraph how it is done.


Whether it's a member function of a class or a normal function, passing by reference works in exactly the same way.

Perhaps you could provide an example of a header file/implementation and explain why you believe it doesn't work.
Topic archived. No new replies allowed.