2011/5/31 Johan Arensman <[email protected]> > Hi, > > Mostly because with Class.create() you can make use of the various > inheritance functionality in the Prototype framework. >
But I see the prototype source code,the Class.create() just return a function,can not find any inheritance functionality > > See http://api.prototypejs.org/language/Class/create/ for more > information. > > Greetings, > Johan > > On Tue, May 31, 2011 at 3:26 PM, maven apache <[email protected]>wrote: > >> Hi: >> >> I am using prototype1.4 now. >> >> When create new class using prototype ,people used to use this manner: >> >> var Person = Class.create(); >> Person.prototype = { >> initialize: function(name) { >> this.name = name; >> } >> printName: function() { >> alert(this.name); >> } >> } >> >> However I can not see the advantage of this manner,since it is very >> readable when use the native javascript: >> >> function Person(name) { >> this.name = name; >> } >> Person.prototype = { >> printName: function() { >> alert(this.name); >> } >> } >> >> Anyone can tell me why? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Prototype & script.aculo.us" group. >> To post to this group, send email to >> [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/prototype-scriptaculous?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Prototype & script.aculo.us" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/prototype-scriptaculous?hl=en. > -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
