Is it possible to change the superclass of one class dynamic

S

Sean Liu

I want to change the super class of one class in one of plugins, for
example,
in plugin
class A < B

end
in rails initialization configuration file,
class A < C

end

but when i did this, the error: "TypeError: superclass mismatch"
appreared.

So can we change the super class of one class dynamically?

Thanks.
 
C

Chris Shea

I want to change the super class of one class in one of plugins, for
example,
in plugin
class A < B

end
in rails initialization configuration file,
class A < C

end

but when i did this, the error: "TypeError: superclass mismatch"
appreared.

So can we change the super class of one class dynamically?

Thanks.

No. That is not possible. It is, however, possible to include (and
extend) modules into a class to change its method and constant lookup
hierarchy.

What is it you're actually trying to accomplish by changing the
superclass?

Chris
 
S

Sean Liu

Chris said:
No. That is not possible. It is, however, possible to include (and
extend) modules into a class to change its method and constant lookup
hierarchy.

What is it you're actually trying to accomplish by changing the
superclass?

Chris

Thanks for quick reply, Chris.
I just want to change the behavior of one plugin without changing it's
source code. I think changing the original source code of that plugin
isn't too bad if we can't change the super class dynamically.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top