Here is the code.
#include <iostream>
using namespace std;
int w=0;
class A{
  int k,n;
 public:
  int z;
  A(){w+=3; k=3+w; n=4+w; z=w;}
  A *fun1(){z=k*n; return this;}
  A *fun2(){z=n*k; return this-1;}
  friend int fun (A *a,int &b);
};
int fun(A *a,int &b)
{ b=a->z+=4;
  return a->k+a->n;
}
int main()
{ int m;
  A a[2];
  cout<<fun(a[1].fun1(),m)<<"\n";
  cout<<m<<"\n";
  cout<<fun(a[1].fun2(),m)<<"\n";
  cout<<m<<"\n";
  cout<<a[0].z+a[1].z<<"\n";
  return 0;
}
When return this-1 happens, what does it mean? Does it mean that the object returned is a[0]? I can't understand.. Thanks!
 
     
    