C++ frequently asked interview questions | Short – Real

This section contains list of real C++ short interview questions and answers frequently asked in IT industries for freshers and experienced. Q-Tell me one important properties of “delete” operator except de-allocation of memory. Answer – “delete” operator calls the destructor of a class. Q Read more →

Can you delete this pointer inside a class member function in C++?

Answer: Yes, we can delete “this” pointer inside a member function only if the function call is made by the class object that has been created dynamically i.e. using “new” keyword. As, delete can only be applied on the object that has been created Read more →

What is purpose of const in this declaration “void function()const”?

const member function, “void function() const” is explained with an example. Need to focus on especially mutable keywords and pointer member in this case. In interview, explaining the concept with example makes answer impressive. Answer: Point -1 Inside the “function()const” class members can’t be Read more →

Design Singleton class in C++ with example – Simple Steps

Answer: Singleton class in C++ is the class that is designed to provide only one unique instance across the system. So, whenever we create c++ singleton instance, it will return the same instance created earlier if any. About method and variables for Designing Singleton Read more →

Difference between new and malloc in C++ – Including Performance

Difference between new and malloc in C++  – The answer of  interview question C++ malloc vs new heap memory allocation includes advantages of new operator over malloc function in C++ programming language. Also, discussion about performance of new and malloc, free() function and delete operators Read more →

What is difference between constructor and member function | By Example

Answer: Here is the difference between constructor and member function in C++ programming. Constructor name must be same as class name but functions cannot have same name as class name. C++ Code Example : class Car{ int count; public: //This constructor has same name Read more →

What default functions provided by compiler in C++?

Below are default functions provided by compiler  in C++ language if not implemented  in a class by a software developer. Default constructor Copy constructor Assignment operator Destructor NOTES Default constructor example: If we don’t write any constructor in a class including c++ copy constructor Read more →