class myString {
public:
myString(int number) {}
myString(myString& paramMyString) {}
myString(myString&& paramMyString) {}
friend myString operator+(const char stString, myString& ndString);
friend myString operator+(myString& stString, const char* ndString);
friend myString operator+(myString& stString, myString& ndString);
myString& operator=(myString& rhs)
{
return *this;
}
myString& operator=(myString&& rhs)
{
return *this;
}
};
myString operator+(const char* stString, myString& ndString)
{
myString rr(0);
return rr;
}
myString operator+(myString& stString, const char* ndString)
{
myString rr(0);
return rr;
}
myString operator+(myString& stString, myString& ndString)
{
myString rr(0);
return rr;
}
Above is example of class. Then I would like to add string to it or initialize this class with same class like below:
myString kk();
myString pp = kk;
myString pp = "sth"+kk;
In second line just above I am getting error that cannot convert from myString to myString but
I made both copying constructor and moving constructor so I don't understand why it is not letting
me initialize myString with myString. How to this?
I would like like also add "sth" to myString. I made overloading operators so I should have not any error.
What is going wrong here?