An array of objects of the class Players is created in the Logic class.

 Players* players = new Players[10]; 

In the main class to access players, the following is done.

 Logic *logic = new Logic(); logic->players[selectPlayer].getName(); 

Is it possible to make a pointer / link like players , which can be written instead of logic->players ? Those. write instead

 logic->players[selectPlayer].getName(); 

this

 players[selectPlayer].getName(); 
  • And why, since you are writing in C ++, you do not use vector or array ? This does not simplify the recording, for this you need to act as @Qwertiy advises, but it turns out more safely. - Mikhailo

1 answer 1

 Logic *logic = new Logic(); Players *&players = logic->players; players[selectPlayer].getName();