int main(){ Shelter sh; Cat c1("Cat1"); Cat c2("Cat2"); Cat c3("Cat3"); Dog d1("Dog1"); Dog d2("Dog2"); Dog d3("Dog3"); sh.enqueue(c1); sh.enqueue(d1); sh.enqueue(d2); sh.enqueue(c2); sh.enqueue(c3); sh.enqueue(d3); Animal ani = sh.dequeueAny(); cout << "DeuqeAny: " << ani.getName() << endl; Cat cc = sh.dequeueCat(); cout << "DeuqeCat: " << cc.getName() << endl; Dog dd = sh.dequeueDog(); cout << "DeuqeDog: " << dd.getName() << endl; }
int main() { Shelter aq; Cat c1("Cat1"); Cat c2("Cat2"); Cat c3("Cat3"); Dog d1("Dog1"); Dog d2("Dog2"); Dog d3("Dog3"); aq.enqueue(d1); aq.enqueue(c1); aq.enqueue(c2); aq.enqueue(c3); aq.enqueue(d2); aq.enqueue(d3); Animal a = aq.dequeueAny(); cout << "Get your pet: " << a.getName() << endl; Cat c = aq.dequeueCat(); cout << "Get your cat: " << c.getName() << endl; Dog d = aq.dequeueDog(); cout << "Get your dog: " << d.getName() << endl; return 0; }
void Node::display() { cout << "Name: " << itsCat->getName() << ", "; cout << "age: " << itsCat->getAge() << endl; if(itsNext) itsNext->display(); }