From: "Iñaki Baz Castillo" Date: 2008-04-11T20:41:11+09:00 Subject: How to duplicate a object changing the class without attributes memory copy Hi, I'm doing a server and want to avoid memory innecesary operations. I have an array of headers: headers_array Each header is an object of "Header" class: class Header attr_accessor :name, :body def initialize(name, body) @name = name @body = body end end There are also others specific headers soons of "Header" class: class From < Header attr_accessor :uri end At the beggining "headers_array" just contain "Header" objects but after inspection I want to replace the header with @name='From' with a "From" object but since "name" and "body" attributes are the same I don't want a memory copy operation to allocate space for new object. This is: I just want to change the Class of a "Header" object to "From" class, keeping the attributes without memory copy operation, is there any way? I imagine in C I'd do it by using pointers. Thanks for any help. -- Iñaki Baz Castillo