C# Programming - Classes and Objects - Discussion

Discussion Forum : Classes and Objects - General Questions (Q.No. 10)
10.
Which of the following statements are correct about the C#.NET code snippet given below?
sample c;
c = new sample();
  1. It will create an object called sample.
  2. It will create a nameless object of the type sample.
  3. It will create an object of the type sample on the stack.
  4. It will create a reference c on the stack and an object of the type sample on the heap.
  5. It will create an object of the type sample either on the heap or on the stack depending on the size of the object.
1, 3
2, 4
3, 5
4, 5
None of these
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
11 comments Page 2 of 2.

Jagan said:   9 years ago
Objects contents are always created on the heap and its reference on the stack.


Post your comments here:

Your comments will be displayed after verification.