Hello,
I have the following C++-Code:
Definition:
class Klasse
{
public:
Klasse operator+(Klasse Op);
public:
int X;
};
Implementation:
Klasse Klasse::operator+(Klasse Op)
{
Klasse Result;
Result.X = this->X + Op.X;
return Result;
};
I want to transfer it to C#, like this:
class Klasse
{
public int X;
public static Klasse operator +(Klasse Op) // 'static' is
obligatory!
{
MVector Result;
Result = new Result();
Result.X = this.X + Op.X; //<- but this doesn't work in
'static'!
return Result;
}
}
The C#-Code is not working, because:
1. operator-methods have to be declared as static
2. static methoden my not use 'this'.
Unfortunately I don't find a solution. Can anybody give me a hint?
Thanks,
Lars