Java2C # translation: public methods in interfaces in C #

Another question about translation, it may be more theoretical, but I'm curious how to choose a design. SFNQ:

Why does C # not allow you to control access control to methods in interfaces such as Java? For example, in the C # interface:

   public void Visit(Axiom axiom);

Thanks.

+3
source share
3 answers

In both C # and Java, all methods on the interface are publicly available.

Java allows a public keyword, which can save on parsing rules. In C #, the public keyword was considered redundant and was generally removed from interface declarations.

+5
source

# .Net . .

, ? , ? ( #, java).

, ?

+6

# , . , (infact, , ).

- , , , . , ( ).

+4

Source: https://habr.com/ru/post/1711180/


All Articles