Worldline interview question

OOPs concept in C++ with example