You are writing the following method (line numbers are included for reference only):
You need to ensure that CreateObject compiles successfully.
What should you do?
A.
Insert the following code at line 02:
where T : new()
B.
Replace line 01 with the following code:
public void CreateObject<T>()
C.
Replace line 01 with the following code:
public Object CreateObject<T>()
D.
Insert the following code at line 02:
where T : Object
A
I don’t agree with A, you initialize T on line 4, if you choose A it would cause 2 initialize operations which is a waist.
I would go for D to force T to an object (reference) type and then get initialized on line 4
I made a mistake here, there is no :
where T : Object
Only:
where T : class
then is the best fit but I still feel it has no value..
then A is the best fir but I still feel is has no value…