Which of the following is TRUE with regards to this code?

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 that manages product data. You have written
the code shown below:
Public static void Save<T>(T target) where T : Product
{
}
Which of the following is TRUE with regards to this code? (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 that manages product data. You have written
the code shown below:
Public static void Save<T>(T target) where T : Product
{
}
Which of the following is TRUE with regards to this code? (Choose all that apply.)

A.
It allows for the Save() method to be strongly typed.

B.
It prevents the Save() method from being strongly typed.

C.
It allows all types regardless of inheritance.

D.
It only allows types inherited from the Product class that makes use of a constructor that
accepts no parameters.

Explanation:



Leave a Reply 9

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


frank

frank

A and D
D because “T:Product” means that generic Type T used here as method’s parameter of Save, inherited from Product

Jonathan

Jonathan

Option A

D : that makes use of a constructor that accepts no parameters
==>
Public static void Save(T target) where T : Product, new()
{
}

Manab

Manab

A only

Krishna

Krishna

Are you sure about A only

Peter

Peter

Why is D also correct ? there is no new() here.

DJOK

DJOK

Please correct an answer, it should be A only. Jonathan is absolutely correct

ralitsa

ralitsa

Only A is the correct answer. If the question was “where T : Product, new()”, it would be A and D.

Boubaker Echieb

Boubaker Echieb

A) only
if D) is true
the Save methode should be like :
public static void Save(T target) where T : Product, new()
{

}