Quote:
What is the different between these two?
The first is a vector of (smart) pointers to elves and the second is a (smart) pointer to a vector of actual elves.
You could compare the first to a sign pointing to a chest of drawers with an elf sitting in each drawer (basically a large house), whereas the second is a chest of drawers where each drawer contains the home address of an elf (basically an address book).
Quote:
How to access _health in the second case?
Solution 1 should work, but if you prefer code that uses the index operator (and thus is closer to the first version), try this:
cout << (*elves)[i].getHealth();
P.S.:
oops, just noticed the date. I assumed it was a new request based on it's listing on the front page...