Let's straight to the point. I have a class named "A". I also have another subclass inherited from "A", I named it "B". Now, I have an object created from "A" and it has complex instance variables. There are arrays, hashes, strings, etc. And for some reasons, I want to clone the object and its instance variables as well and have different class. It's the subclass I'm talking about, the class "B"
I can easily clone the object and its instance variables by using Marshal
Marshal.load(Marshal.dump(object))And the object will be completely "different" from the previous object
However, I can't think about how to change the object class
Any thought?
I can easily clone the object and its instance variables by using Marshal
Marshal.load(Marshal.dump(object))And the object will be completely "different" from the previous object
However, I can't think about how to change the object class
Any thought?