By restricting subclassing to only permitted classes.
Sealed classes prevent rogue implementations by limiting subclassing to only those classes listed in the 'permits' clause. This is especially useful in security-sensitive applications where unauthorized extensions could lead to vulnerabilities. For example, in an authentication system, a sealed class `User` might permit only `AdminUser` and `RegularUser` to extend it, preventing any unapproved user types from being created.
Additional Notes
How do sealed classes prevent rogue implementations?