Ok. I think this is an example of not reading the documentation and
trying to understand the code itself. I actually didn't know about the
feature in javascript that if you change a class' prototype, the
changes will propagate automatically to all of its instances. And
that's where Prototype's inheritance is apparently based on.

I think I had the problems before because I was doing the changing in
a wrong way...

But thank you for correcting my thoughts.

On 23 joulu, 16:51, Allen Madsen <bla...@gmail.com> wrote:
> Yea, addMethods is what you want. You can't just add them directly to the
> klass object.
>
> Allen Madsenhttp://www.allenmadsen.com
>
> On Wed, Dec 23, 2009 at 4:27 AM, T.J. Crowder <t...@crowdersoftware.com>wrote:
>
> > Hi,
>
> > > I ran into problems when I tried
> > > to change a class that another class was extending. The changes did
> > > not inherit.
>
> > Can you post a small, self-contained example? If you use Class.create
> > and addMethods, changes should show up. That kind of dynamism is
> > designed into Prototype's inheritance mechanism and covered by unit
> > tests.
> > --
> > T.J. Crowder
> > Independent Software Consultant
> > tj / crowder software / com
> >www.crowdersoftware.com
>
> > On Dec 22, 1:08 pm, Sakari Tuominen <saka...@gmail.com> wrote:
> > > Hello guys!
>
> > > I've been working with Javascript classes for a while now. I have been
> > > using Prototype's class inheritance. I ran into problems when I tried
> > > to change a class that another class was extending. The changes did
> > > not inherit. I found out that the extending is done when the extending
> > > class is defined.
>
> > > I think it's kinda bad, so I made my own version where the extending
> > > is done with a reference. I even made an article about it. Here it is:
>
> > >http://www.sakarituominen.com/blog/javascript-class-inheritance-madne...
>
> > > Please tell your thoughts!
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Prototype: Core" group.
> > To post to this group, send email to prototype-core@googlegroups.com
> > To unsubscribe from this group, send email to
> > prototype-core-unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/prototype-core?hl=en

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en

Reply via email to