Lamest prototype inheritence evar!

by rpflorence

JavaScript

var MyClass = function(){
    // same as initialize
    this.lame = 'yes'
};

MyClass.prototype = {
    
    say: function(words){
        alert(words);
        return this;
    },
    
    set: function(prop, val){
        this[prop] = val;
        return this;
    },
    
    get: function(prop){
        return this[prop];
    }
    
};

instance = new MyClass;

instance.say('Hi!').say("Is this the lamest class ever? : " + instance.get('lame'));