public class ww
{
public static bool operator != (ww stString, ww ndString)
{
return !(stString == ndString);
}
}
c# operator overloading
josh BAUER
166
Reputation points
I know that it is possible to overload operators in C# same as in c++.
In c++ I would do:
class string {
friend bool operator!=(const string& stString, const char* ndString);
};
bool operator!=(const string& stString, const char* ndString) {
return !(stString==ndString);
}
How to do this in C#?
I do:
class ww {
static public string operator +(string stString, string ndString) {
return "kk";
};
}
I got errors.
Developer technologies C#
11,567 questions
Accepted answer
-
Sam of Simple Samples 5,546 Reputation points
2021-03-08T18:31:15.097+00:00