#612 – Members of an Interface Are Implicitly Public

The idea of an interface is to define a contract that a class can choose to implement. ┬áSince an interface is a public definition of a contract, it doesn’t make sense for members of an interface to be private. ┬áThis means that all members in an interface are implicitly public.

    public interface IDogStuff
    {
        // Implicitly public
        bool CanBark { get; set; }
        void Bark();

        // Compile-time Error: The modifier 'public' is not valid for this item
        public void Fetch();

        // Compile-time Error: The modifier 'private' is not valid for this item
        private void PeeOnTree();
    }