C# Programming - Classes and Objects - Discussion
Discussion Forum : Classes and Objects - General Questions (Q.No. 5)
5.
Which of the following is the correct way to create an object of the class Sample?
- Sample s = new Sample();
- Sample s;
- Sample s; s = new Sample();
- s = new Sample();
Discussion:
2 comments Page 1 of 1.
Andrew Cope said:
1 decade ago
There's nothing wrong with (4) really it just assumes that 's' has already been declared elsewhere.
Karthik said:
1 decade ago
Sample s ;
s = new Sample();
This is another way of Sample s = new Sample();
s = new Sample();
This is another way of Sample s = new Sample();
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers