Skip to content

Instantly share code, notes, and snippets.

@andevsoftware
Created March 11, 2016 08:06
Show Gist options
  • Save andevsoftware/27aa9099e0d521e48330 to your computer and use it in GitHub Desktop.
Save andevsoftware/27aa9099e0d521e48330 to your computer and use it in GitHub Desktop.
TypeScript initialize example
class A {
public get static() {
return Object.getPrototypeOf(this).constructor;
}
constructor() {
console.log('constructor A');
this.initialize();
}
public initialize() {
console.log('initialize A');
}
}
class B extends A {
constructor() {
super();
console.log('constructor B');
}
public initialize() {
console.log('initialize B');
}
}
console.info('instantiate A');
var a = new A();
console.info('instantiate B');
var b = new B();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment