My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

How are global object instances commonly handled in OO languages?

ags's photo
ags
·Jul 4, 2017

I'm a pretty seasoned procedural programmer who only quite recently made the jump to an object-oriented language (Java and C#) and I am having a very hard time understanding how global objects are commonly handled.

For instance, I have a multiplayer game that allows up to 4 players to connect to a server. I have an object with all its methods, etc... I create a new player object instance when a new player connects, but how can I carry these instances over to other source files?