Caterpillar interview question

C++ programming questions - OOPS