Wed Jul 04, 2007 12:36 am
Date dt1( 1,2, 2004);
Date dt2( 2,4, 2005);
Dt1+=100;
Int diff = dt2-dt1;
class NewNumberType
{
double real,
imag;
public:
NewNumberType( double real = 0., double imag = 0.);
NewNumberType operator+(const NewNumberType&) const;
};
NewNumberType::NewNumberType( double r, double i )
{
real = r; imag = i;
}
// Overloading + (plus) operator
NewNumberType NewNumberType::operator+ (const NewNumberType& c) const
{
NewNumberType result;
result.real = (this->real + c.real);
result.imag = (this->imag + c.imag);
return result;
}
int main()
{
NewNumberType x(4,4);
NewNumberType y(6,6);
NewNumberType z = x + y;
}
Wed Jan 23, 2013 11:42 pm
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.