function visibility: What's the difference between "private" and "internal", if any?


  • fivedogitfivedogit Member Posts: 21
    Nevermind. I found the answer in a different place in the same doc.

    public - all
    private - only this contract
    internal - only this contract and contracts deriving from it
    external - Cannot be accessed internally, only externally.

  • MetalMetal Member Posts: 17
    Note that private doesn't really mean what it means in C++.

    You may be expecting that two instances of the same contract would be able to call private methods on each others, but that's not possible, so this won't even compile:
    contract Chatty {
        function chatWith(Chatty buddy) returns (bytes32) {
            return buddy.hello();
        function hello() private returns (bytes32) {
            return "hey there!";
    Effectively, private is a subset of internal.

    Also, external is a subset of public.

Sign In or Register to comment.