Tech Mahindra interview question

OOPS Concept