Ekata interview question

Question related to oops and basic coding