I am trying to create a non-copyable class and inherit it to myclass. Here's how the code looks:
template<class T>
struct NonCopyable
{
protected:
NonCopyable() {}
private:
NonCopyable(const NonCopyable& x) = delete;
T& operator=(const T& x) = delete;
};
The delete allows a third mechanism through re-use of the delete keyword to define a function as “deleted.”
class Myclass : public RefCnt, private NonCopyable<Myclass>
{
virtual unsigned int GetID() = 0;
virtual bool Serialize() = 0;
};
Now when I try this, I get an error on my VS 2010 as: 'NonCopyable' : pure specifier or abstract override specifier only allowed on virtual function.
The compiler is thinking I am trying to create a non virtual function as pure. Can somebody please explain why? I can solve the above problem, by removing "delete" keyword.
You can see from this post that vs2010 does not support defaulted or deleted functions. For that matter neither will vc11