niloy / blog

blog raw files
3 stars 1 forks source link

Abstract class in Javascript #17

Open niloy opened 10 years ago

niloy commented 10 years ago
function AbstractClass() {
    if (Object.getPrototypeOf(this) === AbstractClass.prototype) {
        throw new Error("Sorry, you may not directly instantiate this class");
    }
}