I would like to create an abstract class in javascript, which implements certain methods, calls abstract ones and let the 'inherited' classes to implement these abstract ones. I've read a lot about js prototyping. Every single suggested implementation of abstract classes and methods in javascript seems to be a simple inheritance, but not real abstraction. Here is a really simple example to show what i want to achieve:
var abstractClass = {
abstractMethod: function() { /* i don't know yet what i'm going to do */ },
concreteMethod: function() {
abstractClass.abstractMethod();
}
}
specializedClass = Object.create(abstractClass);
specializedClass.abstractMethod = function() {
alert('Now i know what to do');
}
specializedClass.concreteMethod();
My question: is there a non-hacky, non-workaround way to make abstract classes in javascript?