Write a C++ Program demonstrating Operator Overloading demo2
#include
#include
const size = 3;
class vector
{
int v[size];
public:
vector();
vector (int *x);
friend vector operator * (int a,vector b);
friend vector operator * (vector b,int a);
friend istream & operator >> (istream &,vector &);
friend ostream & operator << (ostream &,vector &); }; vector :: vector() { for(int i=0;i
{
for(int i=0;i
return(din);
}
ostream & operator << (ostream & dout,vector & b) { dout<<"(";//<
cout<
cout<<"m="<
vector p,q;
p=2*m;
q=n*2;
cout<
cout<<"p="<
<
cout<<"q="<<
getch();
}