S

#### stevencheng_2007

when executing the following stentence:

Vertor3 v = p1 - p2;

Here the p1, p2 are variables of self defined struct --- Point3,

Vector3 is also a self defined struct type, they are definitions as

below:

struct Point3 struct

Vector3

{ {

float x, y, z;

float x, y, z;

} }

Point3 overode its -operation:

struct Point3

{

public static Vector3 operator - (Point3 p1, Point3 p2)

{

return new Vector3(p1.x-p2.x, p1.y - p2.y, p1.z - p2.z);

}

}

As I know that the arithmetic between the float type never throw

system.overflowexception.

So, the exception only can be thrown when create a Vector3.

Vector3 has three type constructs:

1. public Vector3(float x, float y, float z)

2. public Vector3(double x, double y, double z)

3. public Vector3(int x, int y, int z)

That means during runtime the construct --- Vector3(int x, int y, int

z) was invoked which eventually caused this exception.

Does anyone could help me to explain how could this case happen? or

there are some errors in my analysis?

Thanks,

Steven