title: I am getting garbage value while using operator overloading
body: <p>I have got a question -</p>
  <blockquote>
  <p>Write a c++ program to calculate Gross salary(net salary+DA+TDS) for 4 employees where overload the + operator for getting the total salary obtained by all the 4 employees. Also get the average salary of employees by operator overloading. display all the details of all four employees. Also display who is getting highest salary. Employee salary must be entered by the user at runtime.</p>
  </blockquote>
  <pre><code>#include&lt;iostream&gt;
  #include&lt;string&gt;
  using namespace std;
  class Employee
  {
      private:
          int net_salary, DA, TDA, Gross_salary;
      public:
          void SetData(int net, int da, int tda, int gross)
          {
              net_salary=net;
              DA=da;
              TDA=tda;
              Gross_salary=gross;
          }
          void GetData()
          {
              cout &lt;&lt; &quot;Enter net salary: &quot;&lt;&lt;net_salary;
              DA = (15*net_salary)/100; //Declaring the value of DA as 15% and calculating the amount 
              //on basis of net salary of the employee
              TDA = (10*net_salary)/100; //Declaring the value of TDA as 10% and calculating the amount
              // of TDA on basis of net salary
              Gross_salary = net_salary+DA+TDA;
          }
          void DisplayData()
          {
              cout &lt;&lt; &quot;Total Gross Salary = &quot;&lt;&lt;Gross_salary;
          }
          Employee operator +(Employee e)
          {
              Employee temp;
              temp.Gross_salary=Gross_salary+e.Gross_salary;
              return temp;
              }
  };
  int main()
  {
      Employee e1,e2,e3,e4,e5;
      e1.GetData();
      e2.GetData();
      e3.GetData();
      e4.GetData();
      e5=e1+e2+e3+e4;
      e5.DisplayData();
      return 0;
  }
  </code></pre>