Question: An Employee class has a property called age and emp is reference to a Employee object and we want the statement Console.WriteLine(emp.age) to fail. Which of the following options will ensure this functionality?
Options
A : Declare age property with only get accessor.
B : Declare age property with only set accessor.
C : Declare age property with both get and set accessors.
D : Declare age property with get, set and normal accessors.
Previous ||
Properties - General Questions more questions
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 following is the correct way to implement....
Which of the folowing does an indexer allow to index....
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....
The string built using the String class are immutable (unchangeable),....
Which of the following snippets are the correct way to....
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