What will be the correct statement in the following C# code?
class trial
{
int i;
float d;
}
struct sample
{
private int x;
private Single y;
private trial z;
}
sample s = new sample();
class trial
{
int i;
float d;
}
struct sample
{
private int x;
private Single y;
private trial z;
}
sample s = new sample();A. trial object referred by z is created on the stack
B. z is created on the heap
C. Both s and z will be created on the heap
D. s will be created on the stack
Answer: Option D

Join The Discussion