move line 11 to apple.cpp
What error does it give you if you move line 11 to the cpp file?
What do you do to compile?
the same error: multiple definition.
But I have actually fixed it by moving it to main.cpp
It shouldn't matter what cpp file its in, as long as it's only in 1 cpp file.
You aren't #including cpp files in other cpp files, are you?
Nope. You can see all in includes in my code above. I think the reason of that error is "apple.h" is included twice, once in apple.cpp and once in main.cpp. That's why it is redefined I guess.
Yes.... having it in apple.h would have the redefined error for the reason you describe. That is correct.
However having it in apple.cpp should work just fine.