SVN / public / code / vorlesung-10 / Thing.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 <string>
#include <iostream>
#include "./Thing.h"

// _____________________________________________________________________________
std::string Thing::toString() { return "THING"; }

// _____________________________________________________________________________
Thing::~Thing() { }

// _____________________________________________________________________________
IntegerThing::IntegerThing(int value) { _value = new int(value); }

// _____________________________________________________________________________
IntegerThing::~IntegerThing() {
  delete _value;
  std::cout << "~IntegerThing" << std::endl;
}

// _____________________________________________________________________________
std::string IntegerThing::toString() { return std::to_string(*_value); }

// _____________________________________________________________________________
StringThing::StringThing(std::string contents) { _contents = contents; }

// _____________________________________________________________________________
std::string StringThing::toString() { return _contents; }