Hi,
I have a basic question about Class.create() Vs creating objects.
I would like to know the pros of one over the other (which one I don't know).
Problem Description:
I would like to write an object "Browser" that has methods like getName,
getVersion...
I could do it any of the following ways -
var Browser = {
this.getName: function() {
},
this.getVersion: function() {
}
};
Or I could do -
var Browser = Class.create();
Browser.prototype = {
initialize: function() {
},
getName: function() {
},
getVersion: function() {
}
}
In the first case when I created an object, I can use it as Browser.getName()
whereas in the second case when I used Class.create(), I need to first do
new Browser();
Browser.getName();
Just want to know if it's a good idea or a bad one to create classes and not
objects?
Could there be memory problems with too many classes?
Thanks,
Mandy.
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs