Howdy!
I’ve been working with Java as back-end since 2009, and abstract classes and methods are pretty nice. How can I create an abstract method (method = function in a class) in my super class that forces an implementation when extending it?
There is no abstract methods implemented in Javascript so far and I am not using something like TypeScript, which I could do it. So a tip is to throw an Error in your super method, because when you implements, it simply overrides the method in the super class.
Here is a very simple example:
I tried to access two methods from my super class. And that was possible, however, the method ‘doSomething’ was throwing me an Error. If I ‘Implement’ this method, I am overriding it.
Here is a new example, implementing those methods:
It is a simple tip, but it will force our programmers to implement what we want.
Cheers!