struct base
{
virtual ~base() { }
virtual base* clone() const = 0;
};
Virtual Constructor Idiom
[C++]
Is there a more elegant way to do a copy of the object pointed by an abstract base class instead of using the Virtual Constructor Idiom?
Not that comes immediately to mind. (Oh, and there's very little reason for a clone() method to be pure virtual.) What do you feel is inelegant about this idiom?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement