As we saw in previous chapters, we are able to perform function overloading. Similarly we can also overload operators “+, -, =, *” and we call this concept as operator overloading. Why do we need operator overloading? Consider a simple example: Generally we use arithmetic addition …
In C++ there is a concept of Dynamic Memory Allocation. The concept of allocating memory during run time is called as Dynamic Memory Allocation. Here the memory allocated in Heap segment. You can use C style “malloc ()” and “free ()” functions, but C++ provides “new” …
An exception is an error condition that occurs during run time. Generally without exception handling, the program will crash when there is an exception. We place the code where the exception might occur and we handle that exception without crashing the program. C++ provides 3 types …
In this chapter we shall see below topics: 1. Class template with overloaded operators 2. Template Inheritance 1. Class template with overloaded operators It is possible to use operator overloading with class template. Below example will show how to achieve the same. Example: #include <iostream> // …