Task 2 - Aggregators
Здравейте!
Защо ми дава error attempting to reference a deleted function в този код(Става дума за 2ра задача от 8мо домашно) :
#ifndef SUMAGGREGATOR_H
#define SUMAGGREGATOR_H
#include "Aggregator.h"
#include <sstream>
class SumAggregator : public StreamAggregator
{
public:
SumAggregator(std::istream stream) : StreamAggregator(stream)
{
//....
}
};
#endif // !AGGREGATOR_H
Това е base class:
#ifndef AGGREGATOR_H
#define AGGREGATOR_H
#include <istream>
class StreamAggregator {
private:
std::istream& stream;
int numAggregated;
protected:
int aggregationResult;
virtual void aggregate(int next) {
this->numAggregated++;
}
public:
StreamAggregator(std::istream& stream) : stream(stream), numAggregated(0) {}
int aggregate() {
int next;
while (this->stream >> next) {
this->aggregate(next);
}
return this->getAggregationResult();
}
int getAggregationResult() const {
return this->aggregationResult;
}
int getNumAggregated() const {
return this->numAggregated;
}
virtual ~StreamAggregator() {}
};
#endif // !AGGREGATOR_H