Is there a better way to create an object-oriented class with jquery?
<p>I use the jquery <a href="http://docs.jquery.com/Utilities/jQuery.extend">extend</a> function to extend a class prototype.</p>

<p>For example:</p>

<pre><code>MyWidget = function(name_var) {
  this.init(name_var);
}

$.extend(MyWidget.prototype, {
   // object variables
   widget_name: '',

   init: function(widget_name) {
     // do initialization here
     this.widget_name = widget_name;
   },

   doSomething: function() {
     // an example object method
     alert('my name is '+this.widget_name);
   }
});


// example of using the class built above
var widget1 = new MyWidget('widget one');
widget1.doSomething();
</code></pre>

<p>Is there a better way to do this?  Is there a cleaner way to create the class above with only one statement instead of two?</p>
