| Language | Default | Public | Restricted |
|---|---|---|---|
| Rust | private to module | pub |
pub(crate), pub(super), pub(in path) |
| C++ | struct: public; class: private | public: |
protected:, private: |
| C# | private (members); internal (types) | public |
internal, protected, private protected |
| Python | public (convention only) | - | _name (private by convention), __name (name-mangled) |
pub(crate) restricts visibility to the current crate, enabling
a public API surface for downstream consumers while keeping implementation details
internal.
#include is textual substitution, not a true
module system. C++20 modules provide proper isolation but adoption is still gradual.
| Language | Unit | Registry | Manifest |
|---|---|---|---|
| Rust | crate (library or binary) | crates.io | Cargo.toml |
| C++ | library (no standard) | vcpkg, Conan | CMakeLists.txt / conanfile |
| C# | assembly / NuGet package | nuget.org | .csproj |
| Python | package (directory or wheel) | PyPI | pyproject.toml |
Cargo.lock) pins exact dependency versions for reproducible builds.