Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Created June 14, 2010 06:38
Show Gist options
  • Save thinkphp/437348 to your computer and use it in GitHub Desktop.
Save thinkphp/437348 to your computer and use it in GitHub Desktop.
#include <iostream.h>
class dublet
{
public: int i;int j;
dublet(int n=1;int m=1){
i=n;
j=m;
}
int operator *(dublet a){ return a.i;}
int operator *(dublet a,dublet b){ return a.i*b.i+a.j*b.j;}
int operator +(dublet a,dublet b){ return a.i+a.j+b.i+b.j;}
};
void main(){
dublet x(4,5),y(3,7);
cout<<2+*x+x+y<<"\n";
cout<<*x*y<<"\n";
cout<<*x+y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment