interface+internal property ?

suppose i write a interface lilke this ..

public interface a

{

int A

{

get;

set;

}

}

What will be the default access modifier for the property in this case.

or in case i declare my interface as internal.



Answer this question

interface+internal property ?

  • enric vives

    Accessibility of interface members is determined by the implementation of the interface. For example;

    interface IPoint {
    int x { get; set; }
    int y { get; set; }
    }

    class Point : IPoint {
    private int _x;
    private int _y;
    public int x {
    get { return _x; }
    set { _x = value; }
    }
    private int y {
    get { return _y; }
    set { _y = value; }
    }
    }

    Point.x is public, Point.y is private.


  • Anarchy

    Properties will be public in both cases. You can't set modifiers for the interface properties

  • interface+internal property ?