August 10, 2008

Go away. This blog is dead.

I good righter.

Now shoo.

Read More......

August 3, 2008

Overloading "=" operator

//Write a program to overload the = operator, and assign data members of one object to that of another object of the same type.
#include iostream //iostream.h wasnt appearing here, so modify before compiling
using namespace std;
class sum
{

public:
int sum1;//,imanidiotwhoneedlesslycomplicatesthings;
int a,b,c;
sum()
{
a=0;
b=0;
c=0;

}
void operator=(sum &d2);
}d1,d2;

void sum::operator=(sum &d2)
{
d2.a=d1.a;
d2.b=d1.b;
d2.c=d1.c;


cout<<"\nAssign invoked\n";

}
main()
{
int a,b,c,d;
cout<<\nEnter int a,b,c to be copied:";
cin>>d1.a>>d1.b>>d1.c;
printf("Elements of obj1:\n%d\n%d\n%d",d1.a,d1.b,d1.c);
printf("Elements of obj2 before override:\n\n%d\n%d\n%d",d2.a,d2.b,d2.c);/*cout wasn't posting either*/
d1=d2;
printf("Elements of obj2 after override:\n\n%d\n%d\n%d",d2.a,d2.b,d2.c);

}

Read More......

July 30, 2008




















Read More......

April 12, 2008

This blog has moved!

Go to Technomite.

Read More......