Weird Problem with return with operator +
Code:
class cXLONG
{
private:
char* pszNumber;
int iLen;
public:
cXLONG() :pszNumber(0), iLen(0) { }
cXLONG(int iNumber) :pszNumber(0) { *this=iNumber; }
cXLONG(const char* pszNumber) :pszNumber(0) { *this=pszNumber; }
~cXLONG() { if ( this->pszNumber ) delete[] this->pszNumber; }
const char* c_str() const { return this->pszNumber; }
void operator=(int iNumber);
void operator=(const char* pszNumber);
void operator=(const cXLONG& xlNumber);
cXLONG operator+(int iNumber);
cXLONG operator+(const char* pszNumber);
cXLONG operator+(const cXLONG& xlNumber);
};
cXLONG cXLONG::operator+(const char* pszNumber)
{
cXLONG xlReturn;
//some code
xlReturn=pszTmp;
return xlReturn;
}
When ever the operator + is called the return value is junk. What is the problem.
Thanks.