dup and clone are used in ruby to create duplicate/clone of an object. So what's the difference between them? They differ in how they operate on frozen object. When frozen object is cloned using clone, the cloned object remains frozen, while when frozen object is duplicated using dup, the duplicated object is not frozen.
No comments:
Post a Comment