C# Modifier ‘sealed’

Modifier: sealed

The sealed modifier is used to stop a class from being inherited or to stop a virtual method from being overridden.


class A {}
sealed class B : A {}
class C : B {}           // This will fail at compile time with CS0509


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: