кто может поможет
#define AccumulatorModuleH
namespace SAMSCalculator
{
class anAccumulator
{
public:
anAccumulator(void);
anAccumulator(anAccumulator &theAccumulator);
float Apply(const aRequest &theRequest) const;
float Value (void) const;
private:
float myValue;
};
};
#endif
в заголовочном файле.
#include <string>
#include <exception>
#include "anAccumulator.h"
namespace SAMSCalculator
{
using namespace std;
anAccumulator::anAccumulator(void):
myValue(0)
{
};
anAccumulator::anAccumulator
(anAccumulator &theAccumulator):
myValue(theAccumulator.myValue)
{
};
float anAccumulator::Apply(const aRequest &theRequest)
{
switch (theRequest.Operator())
{
case aRequest::add:
myValue+=theRequest.Operand();
break;
case aRequest::subtract:
myValue-=theRequest.Operand();
break;
case aRequest::multiply:
myValue*= theRequest.Operand();
break;
case aRequest::divide:
myValue/= theRequest.Operand();
break;
default:
throw
runtime_error
(
string("SAMSCslculator::") +
string("anAccumulator::") +
string("Apply") +
string(" - Unknown operator.")
);
};
return myValue;
};
float anAccumulator::Value(void) const
{
return myValue;
};
};
в реализации.
Выводит вот это:
d:\coding\calculator\calculator\anaccumulator.h(21) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\coding\calculator\calculator\anaccumulator.h(21) : error C2143: syntax error : missing ',' before '&'
d:\coding\calculator\calculator\anaccumulator.cpp(21) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\coding\calculator\calculator\anaccumulator.cpp(21) : error C2143: syntax error : missing ',' before '&'
d:\coding\calculator\calculator\anaccumulator.cpp(22) : error C2511: 'float SAMSCalculator::anAccumulator::Apply(const int)' : overloaded member function not found in 'SAMSCalculator::anAccumulator'
d:\coding\calculator\calculator\anaccumulator.h(14) : see declaration of 'SAMSCalculator::anAccumulator'
Вопрос как исправить 1-4 ошибки. Просьба не пинать.
разобрался, топик можно закрывать. Спасибо за внимание.