Limit protected
inheritance tree to their n-th children
#5569
-
Hello, At the moment, there are only two ways of (not/)sharing fields and methods through inheritance:
Would it be possible to have an n-th inheritance level, something like public class M1
{
protected2 int i = 0;
}
public class M2 : M1 {} // M2.i == 0
public class M3 : M2 {} // M3.i == 0
public class M4 : M3 {} //CS0117: 'M4' does not contain a definition for 'i' This is an open discussion, I'd like to have your pov on those:
Have a nice day. |
Beta Was this translation helpful? Give feedback.
Replies: 0 comments 8 replies
-
You can use the |
Beta Was this translation helpful? Give feedback.
-
What is the usecase for this? |
Beta Was this translation helpful? Give feedback.
-
I see this as similar in some ways to A general "VisibleTo" construct could provide a foundation for friend, and cascade relationships.
|
Beta Was this translation helpful? Give feedback.
-
Probably best discussed in csharplang, moving it.. |
Beta Was this translation helpful? Give feedback.
What is the usecase for this?