Original Post
Could someone give me an example of the operator command to add to calsses, so operator+
on this struct:
struct my_struct
{
float a, b, c;
};
-CProgrammer
class WTF
{
public:
WTF operator + (const WTF&);
private:
int a,b,c;
};
WTF WTF::operator + (const WTF& lRhs)
{
WTF temp;
if(this != &lRhs)
{
temp.a = a + lRhs.a;
temp.b = a + lRhs.b;
temp.c = a + lRhs.c;
}
return(temp);
}
quote:
Original post by Lord Bart
Opps I forgot something in my post.
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more