/**
 * An example of inheritance and polymorphism in action.
 *
 * Author: Zach Tomaszewski
 */
#include <iostream>
#include "Pet.hpp"
#include "Cat.hpp"

using namespace std;


int main() {
  //use of superclass
  Pet* p = new Pet("Rex", "me");
  cout << "The pet named " << p->getName();
  cout << " is owned by " << p->getOwner() << "." << endl;
  cout << p->speak() << endl;
  cout << endl;
  
  //use of subclass
  Cat* c = new Cat("Fluffy", "me");
  cout << "The cat named " << c->getName();
  cout << " is owned by " << c->getOwner() << "." << endl;
  cout << c->speak() << endl;
  cout << endl;
  
  //examples of polymorphism
  Pet* cat = new Cat("Lucky", "me");  //storing a Cat* in a Pet* variable
  cout << "The pet cat named " << cat->getName();  //calling inherited method
  cout << " is owned by " << cat->getOwner() << "." << endl; //calling non-virtual
  cout << cat->speak() << endl;  //calling virtual method
  cout << endl;
  
  delete p;
  delete c;
  delete cat;
}
