Cognizant interview question

OOPS concept in Java and C++