Answer the question
In order to leave comments, you need to log in
Can interfaces in C# define operators?
Hey!
In E. Troelsen's book "The C# 5.0 Programming Language and the .NET 4.5 Platform" in Chapter 9 (Collections and Generics) in the very last paragraph (before "Summary") it says that interfaces can define operations). However, when creating a generic interface and defining an operator, an error is generated: Interfaces cannot contain operators.
Is this an omission of Comrade Troelsen or translators? Or am I just misunderstanding the content of the paragraph?
Answer the question
In order to leave comments, you need to log in
In this case:
"Operation" != "Operator"
"Operation" == "Method"
It is curious what is written there in the original. If something other than "methods", the author is a fat minus. And if all the same "methods", then a bold minus is already for the translator.
PS Judging by the documentation, the task is not solved:
https://docs.microsoft.com/en-us/dotnet/csharp/pro...
PPS Exactly, it is not solved:
An interface can't contain constants, fields, operators , instance constructors, finalizers, or types.https://docs.microsoft.com/en-us/dotnet/csharp/pro...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question