Question
Need help writing these function with certain instruction in it. It is required to implements a Pokedex.cpp class Pokedex { public: // constructor - create
Need help writing these function with certain instruction in it. It is required to implements a Pokedex.cpp
class Pokedex {
public:
// constructor - create empty Pokedex
Pokedex();
// Return size
int size() const;
// Return maximum size, capacity of Pokedex
static int max_size();
// return true if Pokedex is empty
bool empty() const;
// return pokemon at given index
// undefined behaviour for n < 0 or n >= size
const string &at(int n) const;
// return pokemon at the front, alphabetically first one
const string &front() const;
// return pokemon at the front, alphabetically last one
const string &back() const;
// Add pokemon to Pokedex, keep the Pokedex list sorted
// Can have multiple pokemon with the same name
// Pokemon is not inserted if Pokedex is already full
void insert(const string &pokemon);
// Delete the last element
void pop_back();
// Erase element at location, move other elements as needed
// undefined behaviour if given index is not valid
void erase(int n);
private:
// maximum capacity of Pokedex
static const int MAX = 10;
// sorted list of pokemon in Pokedex
string pokemons[MAX];
// current internal size
int msize = 0;
};
// insertion operator, so we can use "cout << pdx"
//ostream &operator<<(ostream &out, const Pokedex &pdx);
#endif // POKEDEX_H
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started