Click here to Skip to main content
16,022,737 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
which are true? Please justify
public class MyContainer<t> where T: class, IComparable
{

}
I. MyContainer class demands that the generic parameter implements IComparable interface.
II. The compiler will report an error for that code block. - False
III. There are multiple constraints on MyContainer generic parameter definition. -True
IV. MyContainer class demands that the generic parameter is of reference type and also implements the IComparable interface.

I tried for option 2 and 3. But donno for 1 and 4. Please clarify
Posted

1 solution

4 is true.
The reasoning I will leave to you, since it is your homework!
 
Share this answer
 
Comments
Member 10491035 28-Dec-13 18:14pm    
After going through various generics articles I think that answers should be
1. False
2. False
3. True
4. True
Let me know if my understanding is correct
OriginalGriff 29-Dec-13 4:15am    
Um.
No. Those are not all correct.
Read them again, and try it as code if you have to...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900