C++ Advanced

A good interview question based on a C++ polymorphism in oops

C++ Technical Interview Question on polymorphism in oops Write a complete class stating function overriding feature in C++ Show the function call in main program. Explain the concept of function overriding. Take example of drawing multiple shapes e.g. circle and rectangle etc. Interviewer Intent: You know the concept and syntax of function overriding in C++ […]

How to delete array of objects in C++? Proof by C++ code for proper deletion

Answer includes how to delete array of objects in C++ created dynamically with C++ code example with proof. In other words, delete array of pointers to objects in c++. Interview Question: Write C++ code to create an array of objects using new keyword and delete these objects. Also, proof that all the objects are deleted […]

How to stop class inheritance in C++ with condition that object creation should be allowed

Answer includes multiple solutions to stop or prevent class inheritance in C++ with condition that object creation of the class should be allowed with C++ program example and explanation. Interview Question: I want to stop a class to be inherited and allow to create an object of the class. Design a solution for this problem […]

What is Advantage and Use of THIS pointer in C++ – Scenarios?

Answer includes uses and advantage of the this pointer in C++ programming with multiple scenarios where the this pointer is used. Sceranio-1: Internal use of this pointer as an argument to a function. Wherever an object calls a class member function, then the compiler internally passes a “this” pointer to the member function internally. For […]

Use of Public Private and Protected access specifiers in C++?

Answer: Use of public private and protected access specifiers in C++ is to control the access/visibility of member data and functions out of a class. It all depends upon requirement when we design a class, what access level to fields and member functions, we want to provide in a class with the use of public private […]

Scroll to top