Ahoy there mateys! This day we shall plunge ourselves down into the sea of C++! I'm serious there so get ready to type! Now you know what we've been doing so far, we've been coding up vectors. But we've had trouble with Evil Dr.Redundancy.....and a new villain Evil Dr.Details. That's why I've prepared two procedures to get rid of them called add, and subtract so that instead of having a ton of redundant code and a ton of details we can just do the code that's in the procedures and have a lot of abstraction. And for each of those two procedures we changed the're names to something special. On add we changed the name to operator+ and on subtract we changed the name to operator- so instead of calling the procedures we can just say resultVector=leftVector+rightVector and it will call operator+ or we can say resultVector=leftVector-rightVector and it will call operator-. And guess what, that helps to get rid of details so we fired a shot at Evil Dr.Details. Aaaaaaaannnnnnnd that also gets rid of redundancy so we hit Evil Dr.Redundancy prrrrrretty hard. And AbstractionMan is now here to help us,and you can't have abstraction without the code to produce it so we've had some help from MemoryMan too. And how MemoryMan helps us is that instead of having six floats to keep track of we have 3 vectors called leftVector,rightVector,and resultVector. Now we're on a roll!
Here is my program:
Vector operator- (Vector left,Vector right)
Vector operator+ (Vector left,Vector right)
void CollinsBasicVectorEquationCallback(const BasicVectorEquationInfo& data)
resultVector= leftVector + rightVector;
resultVector=leftVector - rightVector;