Limited inheritance through sealed #8008
Replies: 2 comments 1 reply
-
What would the purpose be of "hiding" those members? Couldn't you always upcast back to |
Beta Was this translation helpful? Give feedback.
-
In principle, you cannot prevent them from being inherited. These things must appear in the derived class in order for polymorphism to work properly. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What would you think if it were possible to mark methods and properties as sealed and thus prevent them from being inherited?
Here is a small code example
Beta Was this translation helpful? Give feedback.
All reactions