I'm working on a collision system for which I need to copy the colliders of entities.
I make the system such as I don't have to set in stone how I want to handle collision, (and I will start using AABB likely, but might change to SAT) but I will need to make deep copy of colliders whichever algo I will use.
on one hand, deep copy is a requirement, and the copy and swap idiom seemed to be what I should go to.
On the other hand, my collidable
doesn't need to be anything other than an interface, so there should be no reason not to do it pure virtual.
therefore, I began by writing this :
class collidable
{
public:
virtual collidable& operator= (collidable other)=0;
};
But I can't copy construct collidable
because it is pure virtual.
Note than within a same program, I will never use more than one algorithm of collision at the same time, so there wont be conflict of methods.
I don't really know what I'm doing wrong, if its the design side or the technical side, so I'm completely open to suggestions.
How can I force class derived of collidable to implement operator= ?