HP Inc. interview question

Oops Concepts C, C++ basic codings