[Proto-Scripty] Re: I felt rather puzzled at a few code in Class.create function. Anyone else who can help me. TIA
On 5月19日, 下午6时52分, Eric smcdl6...@gmail.com wrote: if (parent) { var subclass = function() { }; subclass.prototype = parent.prototype; klass.prototype = new subclass; parent.subclasses.push(klass); } How to understand these codes ? If I was the author, I will new parent directly and assign it to klass.prototype. So why use usbclass as broker ? --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: I felt rather puzzled at a few code in Class.create function. Anyone else who can help me. TIA
Hi Eric, If I was the author, I will new parent directly and assign it to klass.prototype. That would imply calling the initialize method of the parent class which is something you'd want avoid. So why use usbclass as broker ? subclass is an empty function (parent isn't: it calls parent.prototype.initialize), so instantiating it to define klass.prototype doesn't have any potentially unwanted side effects. Hope this clarifies your question. Best, Tobie --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: I felt rather puzzled at a few code in Class.create function. Anyone else who can help me. TIA
I had understood it completely. I'm Chinese, sorry for my english. Best Thank you. On 5月19日, 下午7时28分, Tobie Langel tobie.lan...@gmail.com wrote: Hi Eric, If I was the author, I will new parent directly and assign it to klass.prototype. That would imply calling the initialize method of the parent class which is something you'd want avoid. So why use usbclass as broker ? subclass is an empty function (parent isn't: it calls parent.prototype.initialize), so instantiating it to define klass.prototype doesn't have any potentially unwanted side effects. Hope this clarifies your question. Best, Tobie --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---