X

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? Student s = new Student(); s[1, 2] = 35;

( 5 )  .  1 Rating  .  9 Attempts
12 views   .  0 comments  .   . 

Download Solution PDF
  1.  class Student { int[ ] a = new int[5, 5]; public property WriteOnly int this[int i, int j] { set { a[i, j] = value; } } }

  2.  class Student { int[ , ] a = new int[5, 5]; public int property WriteOnly { set { a[i, j] = value; } } }

  3.  class Student { int[ , ] a = new int[5, 5]; public int this[int i, int j] { set { a[i, j] = value; } } }

  4.  class Student { int[ , ] a = new int[5, 5]; int i, j; public int this { set { a[i, j] = value; } } }

Give Rating
Report

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

Write Your Comments or Explanations to Help Others
Comments(0)



No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Explore Other Libraries

X




Copyright (c) 2021 TuteeHUB

OPEN APP
Channel Join Group Join