Practice mode C#

What does the sealed modifier do when applied to a C# class?

Correct answer A. It prevents other classes from inheriting from it

Explanation

A sealed class cannot be used as a base class, so class Derived : MySealedClass is a compile error. System.String is a well-known example. sealed can also be applied to an override to stop further overriding in later derived classes. It does not stop instantiation, which is what abstract or a static class does, and visibility is controlled by access modifiers.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.