Skip to content

Tag Archives: CPP-Functions

A function is a set of statements that take inputs, do some specific computation, and produce output. The idea is to put some commonly or… Read More
A whole array cannot be passed as an argument to a function in C++. You can, however, pass a pointer to an array without an… Read More
In C, like normal data pointers (int *, char *, etc), we can have pointers to functions. Following is a simple example that shows declaration… Read More
In Java, we can use final for a function to make sure that it cannot be overridden. We can also use final in Java to… Read More
C++ provides inline functions to reduce the function call overhead. An inline function is a function that is expanded in line when it is called.… Read More
Constant member functions are those functions which are denied permission to change the values of the data members of their class. To make a member… Read More
A default argument is a value provided in a function declaration that is automatically assigned by the compiler if the calling function doesn’t provide a… Read More
Function overloading is a feature of object-oriented programming where two or more functions can have the same name but different parameters. When a function name… Read More
Virtual functions are member functions that are declared in the base class using the keyword virtual and can be overridden by the derived class. They… Read More
  [Note: This was true for older versions of C but has been changed in C11 (and newer versions).  In newer versions, foo() is same… Read More
A virtual function is a member function that is declared in the base class using the keyword virtual and is re-defined (Overridden) in the derived… Read More
In C++ the default return type of main is void, i.e. main() will not return anything. But, in C default return type of main is… Read More
Predict the output of following C++ program. #include <iostream> using namespace std; int main(int a) {     cout << a << "\n";     return 0; } int… Read More
If we have a function in base class and another function with the same name in derived class, can the base class function be called… Read More
A virtual function can be private as C++ has access control, but not visibility control. As mentioned virtual functions can be overridden by the derived… Read More