Knowledge Check - Operators
1. True/False. Operator overloading allows you to define a new operator such as @@
.
False. You cannot define new operators. You can only overload existing operators.
2. True/False. You can overload all C# operators.
False. Only some operators can be overloaded. For example, you can overload +
, -
, *
and /
, but you cannot redefine what the assignment operator (=
) does.
Some operators would be too confusing or dangerous to overload.
3. Operator overloads must be public
and static
.
True. C# does not allow operators that aren’t both public
and static
.