// By using structure :     
struct complex {
  float real;
  float imag;
};    
complex operator+(complex, complex);    
main() { 
  complex t1, t2, t3;    
  t3 = t1 + t2;    
}    
complex operator+(complex w, complex z) {
  statement 1;    
  statement 2;   
}    
// By using class :    
class complex {
  int real;
  int imag;    
public:    
  complex operator+(complex c) {
    statement 1;    
    statement 2;    
  }    
  main() {    
    complex t1, t2, t3;    
    t3 = t1 + t2;    
  }    
While using structure, the overloaded function can accept two arguments whereas while using class the overloaded function accepts only one argument, when the overloaded operator function is a member function in both cases i.e in struct as well as in class. Why does this happen?
 
     
     
     
     
     
     
    