What does the following C# code block defines? [code] class Gen<T> { T ob; } [/code]

What does the following C# code block defines?
Code:
 class Gen<T> 
 {  
      T ob;    
 }
A. Generics class declaration
B. Generic constructor declaration
C. A simple class declaration
D. All of the mentioned
 
Answer: a
Explanation: class Gen<T> This defines the generics declaration where ‘T’ is the name of the type parameter. This parameter is used as a placeholder for the actual type that will be specified when a Gen object is created. Gen is a generic class. T is used to declare a variable called ‘ob’.
 

Tìm kiếm

Back
Top