SVN / public / code / vorlesung-10 / ThingMain.cpp

Revision 11340
Date
Committerhb1003
Download
// Copyright 2016, University of Freiburg,
// Chair of Algorithms and Data Structures.
// Author: Hannah Bast <bast@cs.uni-freiburg.de>.

#include <iostream>
#include <vector>
#include "./Thing.h"

// Main function.
int main(int argc, char** argv) {
  Thing* thing1 = new Thing();
  IntegerThing* thing2 = new IntegerThing(137);
  StringThing* thing3 = new StringThing("doof");

  // std::cout << thing1.toString() << std::endl;
  // std::cout << thing2.toString() << std::endl;
  // std::cout << thing3.toString() << std::endl;

  std::vector<Thing*> things;
  things.push_back(thing1);
  things.push_back(thing2);
  things.push_back(thing3);

  for (auto& thing : things) { std::cout << thing->toString() << std::endl; }

  for (auto& thing : things) { delete thing; }
}