Hello,
I trying to overload operator=, but I got an error every time I tried
This is the .h
#pragma once
#include “CoreMinimal.h”
#include
#include
#include “Kismet/BlueprintFunctionLibrary.h”
#include “LargeNumber.generated.h”
using namespace std;
UCLASS()
class IDLECLICKER_API ULargeNumber : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
private:
string digits;
public:
ULargeNumber();
ULargeNumber& operator=(const ULargeNumber&);
};
this is the cpp
#include “LargeNumber.h”
ULargeNumber& ULargeNumber::operator=(const ULargeNumber& a)
{
digits = a.digits;
return *this;
}
ULargeNumber::ULargeNumber()
{
digits = “”;
digits.push_back(‘0’);
}
And this is the error
1>[1/6] Compile LargeNumber.cpp
1>LargeNumber.h(21): error C2535: ‘ULargeNumber &ULargeNumber::operator =(const ULargeNumber &)’: member function already defined or declared
1>LargeNumber.h(16): note: see declaration of ‘ULargeNumber::operator =’
1>[2/6] Compile LargeNumber.gen.cpp
1>LargeNumber.h(21): error C2535: ‘ULargeNumber &ULargeNumber::operator =(const ULargeNumber &)’: member function already defined or declared
1>LargeNumber.h(16): note: see declaration of ‘ULargeNumber::operator =’
I tried like the 3 first page of google search about this error on this operator but nothing worked, does anyone has an idea ? is this a new bug in 5.1 ?
Thanks