Skip to content

Instantly share code, notes, and snippets.

@abbood
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abbood/10108937 to your computer and use it in GitHub Desktop.
Save abbood/10108937 to your computer and use it in GitHub Desktop.
how to declare abstract classes within object declaration javascript
// the way it's done in the question (http://stackoverflow.com/questions/16963111/javascript-class-inheritance-for-functions/16963189#16963189)
MyBase = function() {
this.m_Stuff = 0; // etc
};
MyBase.prototype.MySuperFunction = function (arg1) {
alert("Hello" + arg1);
};
// how i would like to do it
MyBase = function() {
this.m_Stuff = 0; // etc
// define functions that can be overridden by subclasses
MyBase.prototype.MySuperFunction = function (arg1) {
alert("Hello" + arg1);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment