Tech Mahindra interview question

C++, Coding based on OOPS Concepts