code 2 - r.x = -x; r.y = -y; return r; } void be_oposited()...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
A method is allowed to change the variables of the instance it is acting upon : #include <iostream.h> class vector { public: double x; double y; vector its_oposite() { vector r;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: r.x = -x; r.y = -y; return r; } void be_oposited() { x = -x; y = -y; } void be_calculated (double a, double b, double c, double d) { x = a - c; y = b - d; }...
View Full Document

This note was uploaded on 02/26/2012 for the course MBA IT DOM1 taught by Professor Kviswanathan during the Spring '12 term at Indian Institute of Technology, Chennai.

Ask a homework question - tutors are online