ahh, I c, because I am trying to use an instance method like a static
method, icic, got it!

Thanks!

On Wed, Dec 16, 2009 at 6:16 PM, Slik Jay <[email protected]> wrote:

> there are class methods (static in c++, extends) and instance methods
> (implements):
> var A = new Class({
>     implemented: function(){ alert('i am implemented'); }
> });
> A.extend({extended: function(){ alert('i am extended') }});
>
> when you creating class with new Class({}) you *implements* methods, so
> you can't call A.implemented(), but you can call A.extended(), so if you
> want to add A's methods to class B you must create instanse of class A:
>
> var B = new Class();
> B.implement(new A()); // added 'implemented' method
> B.implement({extended: A.extended}); // added 'extended' method
>
> test:
> http://mooshell.net/zUe8L/
>
> On Wed, Dec 16, 2009 at 4:59 PM, Roman Land <[email protected]> wrote:
> > When you wrote:
> > IExtend.implement(new dynamicClass);
> >
> > How did you know to use the "new .."?
> >
> > Thanks!
> >
> > On Wed, Dec 16, 2009 at 4:52 PM, Slik Jay <[email protected]> wrote:
> >>
> >> @Roman sorry, but I don't understand your question :)
> >>
> >> On Wed, Dec 16, 2009 at 4:12 PM, Roman Land <[email protected]>
> wrote:
> >> > Thanks Fabio, but that didnt work =/
> >> >
> >> > Slik, although you solution worked I triend looking at the code but I
> >> > dont
> >> > understand how you knew to create an instance of the implemented
> class?
> >> > Thanks!
> >> >
> >> > On Wed, Dec 16, 2009 at 3:08 PM, Slik Jay <[email protected]> wrote:
> >> >>
> >> >> em.. http://mooshell.net/aKeYP/ ?
> >> >>
> >> >> On Wed, Dec 16, 2009 at 2:53 PM, Roman Land <[email protected]>
> >> >> wrote:
> >> >> > Not exactly, I did RTFM :)
> >> >> >
> >> >> > I want to extend or implement a class dynamically, like so:
> >> >> >
> >> >> > ExtendMe = new Class ({
> >> >> >   'doIt': function() {'console.log('i did it')}
> >> >> > })
> >> >> >
> >> >> > IExtend = new Class({
> >> >> >   'initialize: function(dynamicClass){
> >> >> >     $extend(this, dynamicClass);
> >> >> >   }
> >> >> > })
> >> >> >
> >> >> > iExtend = new IExtend(ExtendMe);
> >> >> > iExtend.doIt(); // but this doesnt work...
> >> >> >
> >> >> >
> >> >> >
> >> >> > 2009/12/16 Fábio M. Costa <[email protected]>
> >> >> >>
> >> >> >> I think you need Extends.
> >> >> >>
> >> >> >> http://mooshell.net/sHakv/1/
> >> >> >>
> >> >> >> --
> >> >> >> Fábio Miranda Costa
> >> >> >> Solucione Sistemas
> >> >> >> Engenheiro de interfaces
> >> >> >>
> >> >> >>
> >> >> >> On Wed, Dec 16, 2009 at 9:09 AM, Slik Jay <[email protected]>
> >> >> >> wrote:
> >> >> >>>
> >> >> >>> Something*
> >> >> >>>
> >> >> >>> On Wed, Dec 16, 2009 at 1:09 PM, Slik Jay <[email protected]>
> >> >> >>> wrote:
> >> >> >>> > http://mooshell.net/sHakv/
> >> >> >>> > Thomesing like this ?
> >> >> >>> >
> >> >> >>> > On Wed, Dec 16, 2009 at 12:52 PM, Roman Land
> >> >> >>> > <[email protected]>
> >> >> >>> > wrote:
> >> >> >>> >> Hi,
> >> >> >>> >>
> >> >> >>> >> Is there any way to extend / implement a class while
> >> >> >>> >> initializing
> >> >> >>> >> it?
> >> >> >>> >> example:
> >> >> >>> >>
> >> >> >>> >> ExtendMe = new Class ({
> >> >> >>> >>   'doIt': function() {'console.log('i did it')}
> >> >> >>> >> })
> >> >> >>> >>
> >> >> >>> >> IExtend = new Class({
> >> >> >>> >>   'initialize: function(){
> >> >> >>> >>     $extend(this, extendMe);
> >> >> >>> >>   }
> >> >> >>> >> })
> >> >> >>> >>
> >> >> >>> >> iExtend = new IExtend();
> >> >> >>> >> iExtend.doIt(); // but this doesnt work...
> >> >> >>> >>
> >> >> >>> >>
> >> >> >>> >>
> >> >> >>> >> --
> >> >> >>> >> ---
> >> >> >>> >> "Make everything as simple as possible, but not simpler."
> >> >> >>> >>
> >> >> >>> >> - Albert Einstein
> >> >> >>> >>
> >> >> >>> >>
> >> >> >>> >
> >> >> >>
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> > ---
> >> >> > "Make everything as simple as possible, but not simpler."
> >> >> >
> >> >> > - Albert Einstein
> >> >> >
> >> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > ---
> >> > "Make everything as simple as possible, but not simpler."
> >> >
> >> > - Albert Einstein
> >> >
> >> >
> >
> >
> >
> > --
> > ---
> > "Make everything as simple as possible, but not simpler."
> >
> > - Albert Einstein
> >
> >
>
>


-- 
---
"Make everything as simple as possible, but not simpler."

- Albert Einstein

Reply via email to