C++ overloading virtual = operator
- by taz
Hello, here is the code for my question:
class ICommon
{
public:
virtual ICommon& operator=(const ICommon & p)const=0;
};
class CSpecial : public ICommon
{
public:
CSpecial& operator=(const CSpecial & cs)
{
//custom operations
return *this;
}
};
CSpecial obj;
Basically: I want the interface ICommon to force it's descendants to implement = operator but don't want to have any typecasts in the implementation. The compiler says "can't instantiate an abstract class.
Any help/advice will be appreciated.