javascript solution for prototypal inheritance, privates, low memory requirement