What is the difference between virtual clone and clone? I find the following example, it clone derived to base, what is it for?
class Base{ public: virtual B
Consider this:
Base * b = get_a_base_object_somehow();
// now, b might be of type Base, or Derived, or something else derived from Base
Base * c = b->clone();
// Now, c will be of the same type as b was, and you were able to copy it without knowing its type. That's what clone methods are good for.