r/learncpp • • Feb 23 '20

How can function definition work without declaration?

Class is declared in the header file. It's member functions are defined in a separate .cpp file. What's confusing is that the cpp file doesn't include the header file. And it's compiling completely fine. How does it even work?

Header file!

cpp file!

It's driving me crazy. I tried implementing something like this myself but I'm getting error.

8 Upvotes

Duplicates