Over his blog Dean Edwards has created a new JavaScript Base class in object oriented manner, that eases the pain of JavaScript OO. It’s a simple class and extends the Object object by adding two instance methods and one class method.
He writes "I’m an OO programmer at heart and JavaScript supports prototype based inheritance."
Unfortunatley this leads to verbose class definitions:
function Animal(name) {};
Animal.prototype.eat = function() {};
Animal.prototype.say = function(message) {};
I want a nice base class for JavaScript OO:
I want to easily create classes without the MyClass.prototype cruft
I want method overriding with intuitive access to the overridden method (like Java’s super)
I want to avoid calling a class’ constructor function during the prototyping phase
I want to easily add static (class) properties and methods
I want to achieve the above without resorting to global functions to build prototype chains
I want to achieve the above without affecting Object.prototype
Download the Base class from here Base.js
Explore Base Class in detail ....
|
Rate this Ajax News
Error connecting to mysql
|
|