Category: C++ Basic

C++ Basic interview questions and answers with example asked in IT Industries. List of C++ interview questions or for freshers and experienced both | Only Real.

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 – Can we overload destructor of a class? Answer– No, we…

Read the full article

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 modified. Only class members declared with “mutable” keyword can be modified.…

Read the full article

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 class in C++ Singleton class requires below methods and variables. Private…

Read the full article

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 are included. Note that in a technical interview, generally, it is…

Read the full article

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 : Constructor does not have return type whereas functions must have. C++ Code Example : Member function can be virtual, but, there…

Read the full article

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 then default constructor provided by compiler will be called when we…

Read the full article