objects get assigned the correct constructor