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

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top