class Product {
constructor(name){
this.name = name;
}
init(){
alert('init');
}
fun1(){
alert('fun1')
}
fun2(){
alert('fun2')
}
}
class Creator {
create(name){
return new Product(name)
}
}
let creator = new Creator();
let p = new creator.create('p1');
p.init();
p.fun1();