Data Structures Test 2 Review Dynamic Arrays Flashcards
In the code below, which is the size member variable? class Pitcher { private: int m_capacity; int m_size; : public: Pitcher(int capacity = 4); : };
int m_size;
In the code below, what is the default initial capacity? class Pitcher { private: int m_capacity; int m_size; : public: Pitcher(int capacity = 4); : };
the default initial capacity is 4
initialize the private member variables Pitcher::Pitcher(int capacity) { [WHAT GOES HERE?] }
m_capacity = capacity;m_size = 0; //init size to 0
// Pitcher.h file class Pitcher { private: : : public: Pitcher(int capacity = 4); [WHAT GOES HERE?] : };
void addTea();
// Pitcher.cpp file void Pitcher::addTea() { [WHAT GOES HERE?] }
++m_size;
// Pitcher.h file class Pitcher { private: int m_capacity; int m_size; : public: Pitcher(int capacity = 4); void addTea(); [WHAT GOES HERE?] : };
int getCapacity();int getSize();
// Pitcher.cpp file int Pitcher::getCapacity() { [WHAT GOES HERE?] }
return m_capacity;
// Pitcher.cpp file int Pitcher::getSize() { [WHAT GOES HERE?] }
return m_size;
// Pitcher.h file class Pitcher { : public: Pitcher(int capacity = 4); [WHAT GOES HERE?] : };
Pitcher(Pitcher& copyMe);
// Pitcher.cpp file Pitcher::Pitcher(Pitcher& copyMe) { [WHAT GOES HERE?] }
m_capacity = copyMe.m_capacity;m_size = copyMe.m_size;
// Pitcher.h file class Pitcher { : public: [WHAT GOES HERE?] : };
void operator = (const Pitcher& rhs);
// Pitcher.cpp file void Pitcher::operator= (const Pitcher& rhs) { [WHAT GOES HERE?] }
m_capacity = rhs.m_capacity;m_size = rhs.m_size;
// Pitcher.h file class Pitcher { : public: [WHAT GOES HERE?] };
friend bool operator==(const Pitcher& lhs, const Pitcher& rhs);
// Pitcher.cpp file bool operator== (const Pitcher& lhs, const Pitcher& rhs) { [WHAT GOES HERE?] }
bool retVal = false; if (lhs.m_size == rhs.m_size) retVal = true; return retVal;
// Pitcher.h file [WHAT GOES HERE?] class Pitcher { private: int m_capacity; int m_size; : public: Pitcher(int capacity = 4); : };
enum Flavor { noFlavorSet = -1, raspberry, peach, lemon, grape, strawberry };