#include <iostream>
#include <vector>
using namespace std;
class Watch {
public:
void SetHours(int watchHours) {
hours = watchHours;
}
void SetMins(int watchMins) {
mins = watchMins;
}
virtual void PrintItem() {
cout << hours << ":" << mins << endl;
}
protected:
int hours;
int mins;
};
class SmartWatch : public Watch {
public:
void SetPercentage(int watchPercentage) {
batteryPercentage = watchPercentage;
}
void PrintItem() {
cout << hours << ":" << mins << " " << batteryPercentage << "%" << endl;
}
private:
int batteryPercentage;
};
int main() {
SmartWatch* watch1;
SmartWatch* watch2;
Watch* watch3;
vector<Watch*> watchList;
unsigned int i;
watch1 = new SmartWatch();
watch1->SetHours(3);
watch1->SetMins(50);
watch1->SetPercentage(65);
watch2 = new SmartWatch();
watch2->SetHours(1);
watch2->SetMins(21);
watch2->SetPercentage(96);
watch3 = new Watch();
watch3->SetHours(2);
watch3->SetMins(12);
watchList.push_back(watch2);
watchList.push_back(watch1);
watchList.push_back(watch3);
for (i = 0; i < watchList.size(); ++i) {
watchList.at(i)->PrintItem();
}
return 0;
}