Question: Matching question Using the following program segment, identify the following using the best definition available: 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4
Matching question
Using the following program segment, identify the following using the best definition available:
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 namespace ConsoleApplication1
6 {
7 class Program
8 {
9 static void Main(string[] args)
10 {
11 widget w;
12 w = new widget(10);
13 Console.WriteLine(w.GetSprockets());
14 Console.WriteLine(w.Sprockets);
15 }
16 }
17 class widget
18 {
19 private int gears;
20 private int sprockets;
21 public widget(int a)
22 {
23 gears = a;
24 sprockets = gears % 3;
25 }
26 public int GetSprockets()27 {
28 return sprockets;
29 }
30 public void SetSprockets(int a)
31 {
32 sprockets = a;
33 }
34 public int Sprockets
35 {
36 get
37 {
38 return sprockets;
39 }
40 set
41 {
42 sprockets = value;
43 }
44 }
45 }
46 }
|
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
