::inherit method for pure JS