Skip to content

Instantly share code, notes, and snippets.

@Shinpeim
Created July 11, 2016 06:08
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 Shinpeim/04228adcea30a2cd604e751b9d0b09a9 to your computer and use it in GitHub Desktop.
Save Shinpeim/04228adcea30a2cd604e751b9d0b09a9 to your computer and use it in GitHub Desktop.
const P = require("P");
class A extends P {
}
const P = require("P");
class B extends P {
}
const A = require("A");
const B = require("B");
class P {
static function factory(param){
if (param.isA()) {
return new A();
} else {
return new B();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment