Like template function, we can create a template class that will operate on generic types. That means that we can have a single class that will work for, say, int, double, string etc. We don’t need to have separate class from each data type. In this example, we have a template class, LinkedList. We can … Continue reading “Template Class in C++”
Author: Srikanta
Template Function in C++
In C++, we can write a function to operate on generic types. If we want to have the same function for different data types like, int, double, string, etc., we can have only one template function instead of having different functions with different names or multiple overloaded functions. In this example, we have a template … Continue reading “Template Function in C++”
Function Overriding in C++
In inheritance, the derived class inherits all the functions from the base class with same behavior. That means that an inherited function will behave in the exact same way in both derived and base classes. But we can redefine the behavior of a particular inherited function in derived class. The feature is called function overriding. … Continue reading “Function Overriding in C++”
Operator Overloading in C++
In C++, we can make the operators work for user defined data types. The meaning of the operator will depend on the implementation. This feature is known as operator overloading. One operator can work in some way on operands of standard data types. And the same operator can work in different ways on operands of … Continue reading “Operator Overloading in C++”
Function Overloading in C++
Function overloading is a feature of having multiple functions with same name but different input parameters. The input parameters of the overloaded functions should be different in some way. Either the data types of the input parameters could be different or the number of input parameters could be different. This is one of the important … Continue reading “Function Overloading in C++”