C# Programming - Properties - Discussion
Discussion Forum : Properties - General Questions (Q.No. 14)
14.
Which of the following statements is correct about properties used in C#.NET?
Discussion:
5 comments Page 1 of 1.
Sridhar said:
6 years ago
Option A correct also Example Public int Eno{get;set;}.
Public string ename {get;set;}.
Every property must declare with get as well as set. Am I right?
Public string ename {get;set;}.
Every property must declare with get as well as set. Am I right?
Angel said:
10 years ago
But "B" is also correct. Properties cannot be overloaded in C#.
Raghu said:
1 decade ago
Answer D can't be right because it is saying that a property can be either read only or write only.
But it didn't mention that property can be both.
Means read and write only.
But it didn't mention that property can be both.
Means read and write only.
Ajay said:
1 decade ago
Hi,
I think C option is wrong because Properties are used to get (fetch) or set (initialize) the data members in a class it does not work like data members.
Answer D is right we can declare a property either read only or write only. At least one (get or set) should be declare for property.
I think C option is wrong because Properties are used to get (fetch) or set (initialize) the data members in a class it does not work like data members.
Answer D is right we can declare a property either read only or write only. At least one (get or set) should be declare for property.
Vikalp said:
1 decade ago
But sir a property can be read only or write only it is also right.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers