Hi, See the following code sinppet, I know we can mixin modules, but if i use modules, I wont be able to override the methods in modules. Can we inherit from more than one class?
<html> <head> <script src="prototype_1_6.js"> </script> <script> var Person = Class.create({ initialize: function(name) { alert("init person"); this.name = name; }, say: function(message) { return this.name + ' person : ' + message; } }); var Intelligent = Class.create({ initialize: function(name) { alert("init intelligent"); this.name = name; }, sayin: function(message) { return this.name + 'intelligent : ' + message; } }); var Genius = Class.create(Person,Intelligent, { initialize: function(name) { this.name = name; }, tell: function($super, message) { return $super(message) + ', yarr!'; } }); </script> </head> <body> <script> var t = new Genius("X"); alert(t.say("Says hi")); //->X person Says hi alert(t.sayin()); // ->Throws javascript error - Object doesnt support this property or method </script> </body> </html> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---