function classFactory() { return class Foo { #foo = "foo"; static #bar = "bar"; instance() { return this.#foo; } static() { return Foo.#bar; } static instance(inst) { return inst.#foo; } static static() { return Foo.#bar; } }; }