Let me start by saying I\'ve extensively searched for answers on google and more specifically here.
The thing is I actually (at least I think I did) found people wit
Player
class, in your header fileextern
to use variable that has an external linkage, and is already defined in some other file.For example: you have file a.cpp
, and inside this file has a global variable Player p
. If you want to use the same exact instance p
of Player
in file c.cpp
, then inside file c.cpp
you write extern Player p
.
I hope i made myself clear.