With following code I'm facing an issue: ABC.h
namespace abcd
{
class ABC
{
public:
ABC() = delete;
ABC(const std::string& filename);
virtual ~ABC();
ABC(const ABC&) = delete;
ABC(ABC&&) = default;
}
}
XYZ.h
using namespace abcd;
Class XYZ
{
public:
void func();
private:
ABC obj;
ABC maskfilename(std::string filename);
}
XYZ.cpp
XYZ::func()
{
obj = maskfilename("abcd.txt"); //Error
}
abcd::ABC XYZ::masked(string filename)
{
abcd::ABC ret;
blah blah...
return ret;
}
Error: "abcd::ABC::operator=(const abcd::ABC &)" (declared implicitly) cannot be referenced -- it is a deleted function
I understand it is move constructor only class (ABC). What is the right way to use this? I want to retain return value from maskfilename in the XYZ class, So it can be used in other functions of XYZ class. How can I resolve this error?
Aucun commentaire:
Enregistrer un commentaire