C# Programming - Classes and Objects - Discussion
Discussion Forum : Classes and Objects - General Questions (Q.No. 1)
1.
Which of the following statements is correct about the C#.NET code snippet given below?
class Student s1, s2; // Here 'Student' is a user-defined class.
s1 = new Student();
s2 = new Student();Discussion:
17 comments Page 2 of 2.
Vaiju said:
1 decade ago
s1 and s2 contains the address that where the content is stored.
So s1 and s2 are stored at diff memory locations so obviously .
So s1 and s2 are stored at diff memory locations so obviously .
Sundar said:
1 decade ago
@G.Sriram
What if the constructor assigns random values to the member variables of the instance of the class ?
What if the constructor assigns random values to the member variables of the instance of the class ?
Manish Kumar said:
1 decade ago
@Andrew Cope.
I agree its better to say "The characteristics of the two objects will be the same".
I agree its better to say "The characteristics of the two objects will be the same".
Mayank Srivastava said:
1 decade ago
I am agree with Indrapal. I have also tried it and it shows that objects has the different content.
Monk said:
9 years ago
class Student s1, s2;
Can anyone explain what is s1,s2 here, whether is it class or variable?
Can anyone explain what is s1,s2 here, whether is it class or variable?
GardenExit said:
10 years ago
@Indrapal.
s1 and s2 have different hashcodes.
So,
s1 == s2
It can never be true.
s1 and s2 have different hashcodes.
So,
s1 == s2
It can never be true.
Paurush said:
1 decade ago
What is the differnce b/w option A and C ?
Please clarify the solution.
Please clarify the solution.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers