Saved Bookmarks
| 1. |
Can You Prevent Your Class From Being Inherited And Becoming A Base Class For Some Other Classes? |
|
Answer» YES, that’s what KEYWORD sealed in the class definition is for. The DEVELOPER TRYING to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It’s the same CONCEPT as final class in Java. Yes, that’s what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It’s the same concept as final class in Java. |
|