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

What does the following C# code block define?
Code:
 class Gen<T> {  
                  T ob;    
              }
A. Generics class declaration
B. Declaration of variable
C. A simple class declaration
D. Both Generics class declaration & Declaration of variable
 
Answer: d
Explanation: class Gen<T> This defines the generics declaration where ‘T’ is the name of 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