#include #include "LargeCowMatrix.h" int LargeCowMatrix::instanceCounter = 0; LargeCowMatrix::LargeCowMatrix() : value(-1), referenceCounter(0){ instanceCounter++; } LargeCowMatrix::LargeCowMatrix(int value) : value(value), referenceCounter(0){ instanceCounter++; } LargeCowMatrix::LargeCowMatrix(const LargeCowMatrix& source) : value(source.value), referenceCounter(source.referenceCounter){ instanceCounter++; } LargeCowMatrix::~LargeCowMatrix() { instanceCounter--; } LargeCowMatrix::operator int() { return value; } LargeCowMatrix LargeCowMatrix::operator+(const LargeCowMatrix &other) { return LargeCowMatrix(value + other.value); } LargeCowMatrix &LargeCowMatrix::operator++(int) { value++; return *this; } bool LargeCowMatrix::operator==(const LargeCowMatrix &other) { return this->value == other.value; } bool LargeCowMatrix::operator!=(const LargeCowMatrix &other) { return !(*this==other); } bool LargeCowMatrix::instanceCountExceeds(int max) { bool result = instanceCounter>max; if(result) std::cout << LargeCowMatrix::instanceCounter << " > max=" << max << std::endl; return result; }