Question: Which of the following is the correct way to implement a read only property Length in a Sample class?
Options
A : class Sample { int len; public int Length { get { return len; } } }
B : class Sample { public int Length { get { return Length; } } }
C : class Sample { int len; public int Length { get { return len; } set { len = value ; } } }
D : class Sample { int len; public int Length { Readonly get { return len; } } }
Properties - General Questions more questions
If a Student class has an indexed property which is....
If Sample class has a Length property with get accessor....
An Account class has a property called accountNo and acc....
Suppose a Student class has an indexed property. This property....
Which of the following statements is correct about properties used....
Which of the folowing does an indexer allow to index....
An Employee class has a property called age and emp....
Which of the following statements are true about the C#.NET....
Which of the following will be the correct output for....
Which of the following statements will correctly copy the contents....
Attributes - General Questions more Online Exam Quiz
Inheritance - General Questions
Interfaces - General Questions
Namespaces - General Questions
Polymorphism - General Questions
Structures - General Questions
Advanced SQL - General Questions
Data and Database Administration - General Questions