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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!