Question: If a class Student has an indexer, then which of the following is the correct way to declare this indexer to make the C#.NET code snippet given below work successfully?
Options
A : class Student { int [ ] a = new int [ 5 , 5 ]; public property WriteOnly int this [ int i, int j] { set { a[i, j] = value ; } } }
B : class Student { int [ , ] a = new int [ 5 , 5 ]; public int property WriteOnly { set { a[i, j] = value ; } } }
C : class Student { int [ , ] a = new int [ 5 , 5 ]; public int this [ int i, int j] { set { a[i, j] = value ; } } }
D : class Student { int [ , ] a = new int [ 5 , 5 ]; int i, j; public int this { set { a[i, j] = value ; } } }
Properties - General Questions more questions
Which of the following statements is correct?
Which of the following are necessary for Run-time Polymorphism?
A property can be declared inside a class, struct, Interface.
Which of the following statements is correct about properties used....
A Student class has a property called rollNo and stu....
Which of the following statements are correct?
If Sample class has a Length property with get and....
Which of the following is the correct way to implement....
A property can be declared inside a namespace or a....
If a Student class has an indexed property which is....
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