Which of the following is TRUE with regards to sealed classes?

You work as a developer at ABC.com. The ABC.com network consists of a single domain named
ABC.com.
You have been tasked with creating an application for ABC.com. The written code includes a
sealed class.
Which of the following is TRUE with regards to sealed classes? (Choose all that apply.)

You work as a developer at ABC.com. The ABC.com network consists of a single domain named
ABC.com.
You have been tasked with creating an application for ABC.com. The written code includes a
sealed class.
Which of the following is TRUE with regards to sealed classes? (Choose all that apply.)

A.
It cannot be instantiated.

B.
It cannot be used as a base class.

C.
It provides a common definition of a base class that multiple derived classes can share.

D.
It is used to prevent derivation.

Explanation:



Leave a Reply 4

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


frank

frank

B and D because keyword “Sealed” applied on Class is opposite of “Abstract Class”.
It’s used on class to means that “This class can not be Derived from”.
So this class can not be used as base class and derivation is not allowed.

Chinmay

Chinmay

We can create an object of a class marked as sealed
sealed class Program
{
public void add(int a, int b)
{
int c = a + b;
Console.WriteLine(c);

}
public static void Main(string[] args)
{
Program p = new Program();
p.add(4, 5);

Console.ReadLine();
}
}
The program runs without any error.So its possible to create object of sealed class
B & D

Manab

Manab

It cannot be used as a base class because It is used to prevent derivation. BD