C++ uses the three modifiers called public, protected, and private.3 C# has the modifiers public, protected ,internal, private, protected internal, private protected, and file.4 Java has public, package, protected, and private; package is the default, used if no other access modifier keyword is specified. The meaning of these modifiers may differ from one language to another. A comparison of the keywords, ordered from the most restrictive to the most open, and their meaning in these three languages follows. Their visibility ranges from the same class to the package where the class is defined to a general access permission. Below, the maximal access is written into the table.
In Swift, there are five different access levels relative to both the source file in which the entity is defined and the module containing that source file.5
Mayo 2002, pp. 199. - Mayo, Joseph (2002), C Sharp Unleashed, Sams publishing, ISBN 9780672321221 https://books.google.com/books?id=XdHYaE-Il9gC ↩
Wagner, Bill. "Access Modifiers - C# Programming Guide". docs.microsoft.com. Retrieved 2020-01-13. /wiki/Bill_Wagner_(software) ↩
"Access specifiers". en.cppreference.com. Retrieved 2020-01-13. https://en.cppreference.com/w/cpp/language/access ↩
"Access Modifiers (C# Reference)". learn.microsoft.com. Microsoft. 2022-09-27. Retrieved 2023-02-08. https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/access-modifiers ↩
"Access Control — The Swift Programming Language (Swift 5.3)". docs.swift.org. Retrieved 2021-02-08. https://docs.swift.org/swift-book/LanguageGuide/AccessControl.html ↩