Overloading Addition operator in C++

Here we have overloaded addition operator for a specific class or one can say addition operator is overloaded for a self-defined data type in C++. The code is: ...

Increment operator overloading in C++

Increment operator in C++ is used to increase the value of a variable by 1 or some other fixed interval. normally it is used in loops. Now increment operator overloading is...

Area and Perimeter of rectangle in C++

Area and Perimeter both are the mathematical terms used with rectangle, area is the length multiplied by width while perimeter is the length of all sides of the rectangle. Now how...

Classes with applications in C++

Classes are defined by using the keyword “ class ”  and have a body closed in braces {}  just like structures and ends with a semicolon( ; ). We cannot initialize...

Linked Lists with applications in C++

In computer science, linked lists are data structure consisting of a group of nodes which together represent a sequence. Under the simplest form, each node is composed of a data and...

Assignment Operator Overloading in C++

After we do assignment operator overloading, we will then be able to assign two variables of our self-defined datatypes. Lets have a look at the below example: // Operator overloading in C++ //assignment operator overloading #include<iostream> using namespace std;   class Employee { private:     int idNum;     double salary; public:     Employee ( ) {         idNum = 0, salary = 0.0;     }       void setValues (int a, int b);     void operator= (Employee&emp );   };   void Employee::setValues ( int idN , int sal ) {       salary = sal; idNum = idN;   }   void Employee::operator = (Employee&emp)  // Assignment operator function {     salary = emp.salary; }   int main ( ) {       Employee emp1;     emp1.setValues(10,33);     Employee emp2;     emp2 = emp1;        // emp2 is calling object using assignment operator   } Now lets explain this...

Object Oriented Programming and Databases

Programming itself evolved from several stages and now we have Object Oriented Programming as the most mature and popular approach. On the other hand, interaction with database has always been tricky...

Creating a Calculator program in Java

Java, being a power full language, contributes in many technology fields. It has deep contribution in the modern world. A basic calculator program in java can perform logical computations and displays...

constructors and destructors in C++

We can use a constructor as a function and can pass arguments to it, but it must have no return type. Destructors are also member function of the class which Performs...

Performing Operator Overloading in C++ with example

As we know The variables of primitive data types can perform a number of different operations (functions) using operators like (+, - , /, *)/ For Example: a + b * c...