Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Is it possible to change the superclass of one class dynamic
Sean Liu
7/28/2008 3:47:00 AM
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.
--
Posted via
http://www.ruby-...
.
2 Answers
Chris Shea
7/28/2008 4:07:00 AM
0
On Jul 27, 9:47 pm, Sean Liu <seanli...@gmail.com> wrote:
> 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.
> --
> Posted via
http://www.ruby-...
.
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
Sean Liu
7/28/2008 4:50:00 AM
0
Chris Shea wrote:
> On Jul 27, 9:47�pm, Sean Liu <seanli...@gmail.com> wrote:
>>
>> but when i did this, the error: "TypeError: superclass mismatch"
>> appreared.
>>
>> So can we change the super class of one class dynamically?
>>
>> Thanks.
>> --
>> Posted via
http://www.ruby-...
.
>
> 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.
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Is it possible to change the superclass of one class dynamic
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password