Amazon interview question

OOP based questions