What is the meaning of the + in the declaration method?

G

Guest

Hi everyone,

I am learning c# and i don´t understand a piece of code , can anyone
explain the meaning of this code please.

public class vector
{
public double? R = null; //I suppose this is a Generic Type ???
..........

public static vector operator +(vector op1, vector op2) // What is the
meaning of the + ???
{
...........
}
}
}

Thanks in advance

Jolynice

P.S.
My english is not very good i know :(
 
H

Hans Kesting

Hi everyone,
I am learning c# and i don´t understand a piece of code , can anyone
explain the meaning of this code please.

public class vector
{
public double? R = null; //I suppose this is a Generic Type ???
..........
public static vector operator +(vector op1, vector op2) // What
is the
meaning of the + ???
{
...........
}
}
}

Thanks in advance

Jolynice

P.S. My english is not very good i know :(

This code is defining a new meaning for the "+" operator, when used between
two "vector" types.

So you can use:
vector v1, v2, v3;
v1 = ..;
v2 = ..;
v3 = v1 + v3;


Hans Kestin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top