title: How to create functions to manipulate objects inside objects with protected or private atributes?
body: <p>I'm trying to learn about classes/inheritance(in general), so I'm trying to make a game as a semester final project. </p>
  
  <p>Lets say I have a class <strong>SOLDIER</strong> with an object of a class <strong>INVENTORY</strong> with an object of a class <strong>POTION</strong> (with size and amount). </p>
  
  <p>If I want to make a function use_potion(), how do I do that? I could have everything public to make something like "soldier1.addlife(soldier1->inventory1->potion1->size), but that looks like a terrible practice. How do I do implement that with private/protected atributes? </p>
  
  <p>*The potion is only 1 of the functions I will need to make with the same structure - <em>object->object->object->something</em> -, so I really need some help and examples to understand how to make them.</p>