Sachar Gaming interview question

Question around oops concept