Not sure exactly what is the error that you get, however, the code below compiles just fine (a simplified version of your class)
#include <iostream>
#include <string>
using namespace std;
class LargeNum
{
public:
int value;
//todo constructor, inital point
//constructor
LargeNum(int value):value(value){};
LargeNum(string value){};
//destructor
~LargeNum(){};
//members
const LargeNum operator+ (const LargeNum& ln2)
{
LargeNum result = value + ln2.value;
return result;
}
};
int main()
{
LargeNum L1=4;
LargeNum L2=5;
LargeNum L3=L1+L2;
cout <<L3.value;
}
and outputs 9 as a result. Btw, you don't need the extra LargeNum::
qualification when declaring operator+()
. Check if it compiles without, if not, please post the whole code (with implementation) in a single file.