Skip to main content
GameDev.net gamedev.net
๐Ÿ”’ Locked

type based operators

Started by original vesoljc Dec 29, 2002 at 7:22 PM 1 replies 150+ views
Original Post
original vesoljc
original vesoljc
can u do something like:
  
class Vector
{
 float x,y,z;
 Vector operator+ (Vector& lVector);
 Vector operator- (Vector& lVector);
};

class Matrix
{
 data[4][4];
 Matrix operator* (MAtrix& lMAtrix);
 Vector operator* (Vector& lVector);
};
  
so that u can do:
  
main()
{
 Vector a,b,c;
 MAtrix m1,m2,m3;

 a = b + c;
 m1 = m2 * m3;
 a = m2 * a; // ?!?

}
  
Abnormal behavior of abnormal brain makes me normal...
Abnormal behavior of abnormal brain makes me normal...
original vesoljc
original vesoljc
guess it works

Abnormal behavior of abnormal brain makes me normal...
Abnormal behavior of abnormal brain makes me normal...
cnstrnd
cnstrnd
abnormal behavior of abnormal brains makes me average

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.