Final

The final flag prevents child classes from overriding a method by prefixing the definition with final. If the class itself is being defined final then it cannot be extended.

Final only affects the specific method signature, including types.

Making a class final

var BaseClass = Class({ final: true }, {
    // Class body ...
});

// Error: Unable to extend on a final class.
var ChildClass = Class({ extends: BaseClass }, { /* ... */ });

Making a method final

var BaseClass = Class({
    'final public getName()' : function() {
        return 'Bob';
    }
});

// Error: 'Final member "getName()" cannot be overwritten.'
var ChildClass = Class({ extends: BaseClass }, {
    'public getName()' : function() {
        return 'John';
    }
});

// This succeeds, since the method has a different signature
var ChildClass = Class({ extends: BaseClass }, {
    'public getName(string)' : function(str) {
        return 'John ' + str;
    }
});

var cc = new ChildClass();

cc.getName(); // Bob
cc.getName("Test"); // John Test