I need a solution for multiple inheritance. I know that I can use interfaces. That would be good solution but...
I need opportunity to change protection level but fields of interface must be public.
For example:
I have
interface IInterface_1 {
string field_1{set;get;}
string field_2{set;get;}
}
interface IInterface_2 {
string field_3{set;get}
string field_4{set;get}
}
And in main class I need to hide some fields
class MainClass : IInterface_1, IInterface_2 {
public string field_1{set;get;}
private string field_2{set;get;}
public string field_3{set;get}
public string field_4{set;get}
}
Do you have any solution for this?
[Copied from Robson's question and his rejected edit to Marc's answer]
My solution is:
public class PermissionDeniedException : Exception {}
class MainClass : IInterface_1, IInterface_2 {
public string field_1{set;get;}
private string field_2{set;get;}
string IInterface_1.field_2 {
get {throw new PermissionDeniedException();}
set {throw new PermissionDeniedException();}
}
public string field_3{set;get}
public string field_4{set;get}
}