Skip to content

Category Archives: C++

In C++, class variables are initialized in the same order as they appear in the class declaration. Consider the below code. #include<iostream>    using namespace… Read More
Ideally delete operator should not be used for this pointer. However, if used, then following points must be considered.1) delete operator works only for objects… Read More
delete and free() in have similar functionalities programming languages but they are different. In C++, the delete operator should only be used either for the… Read More
Following are the differences between malloc() and operator new.:  Calling Constructors: new calls constructors, while malloc() does not. In fact primitive data types (char, int,… Read More
In C++, a static member function of a class cannot be virtual. Virtual functions are invoked when you have a pointer or reference to an… Read More
Calling an undeclared function is a poor style in C (See this) and illegal in C++and so is passing arguments to a function using a… Read More
Write a program that accepts a number from the user and prints “Even” if the entered number is even and prints “Odd” if the number… Read More
No, the C++ compiler doesn’t create a default constructor when we initialize our own, the compiler by default creates a default constructor for every class;… Read More
Reference Variables: You can create a second name for a variable in C++, which you can use to read or edit the original data contained… Read More
Local Variable: The variable whose scope lies inside a function or a block in which they are declared.  Global Variable: The variable that exists outside… Read More
A copy constructor is a member function that initializes an object using another object of the same class. (See this article for reference). When should… Read More
In C, it is not possible to have function names on the left side of an expression, but it’s possible in C++.  How can we… Read More
In C, data type of character constants is int, but in C++, data type of same is char.  If we save below program as test.c… Read More
There are various ways to overload Operators in C++ by implementing any of the following types of functions: 1) Member Function 2) Non-Member Function 3)… Read More
A quine is a program which prints a copy of its own as the only output. A quine takes no input. Quines are named after… Read More

Start Your Coding Journey Now!