I've a class PokemonCollection
which has a private list which accepts a pair.
Now what I've to do is, when I make an object"collection" of that class PokemonCollection
in main()
function, I pass some pairs to the constructor, and in the constructor I've to initialize the private list of the class.
PokemonCollection collection({pair<string, size_t>("Pikachu", 25),
pair<string, size_t> ("Raticate", 20), pair<string, size_t>("Raticate", 20),
pair<string, size_t>("Bulbasaur", 1), pair<string, size_t>("Pikachu", 25),
pair<string, size_t>("Diglett", 50)});
this confuses me alot, can someone kindly help me as I'm a beginner, also I've to print that private list too.
collection.print();
where print is public function of my class.
class definition:
class PokemonCollection{
public:
void print();
private:
list<pair<string, size_t>> pokemons_;
};
where "size_t" is an identifier for the pokemon name. I have this hint in my assignment for the constructor:
/* constructor
* initializes the collection to by copying the parameter
*/
PokemonCollection(const std::list<std::pair<std::string, size_t>>& pokemons){}