Question: This is the whole question Question 9 (5+3 marks) This question asks about object diagrams. Please consider the following C# code. class Hobbit { BindingList

This is the whole question Question 9 (5+3 marks) This question asksThis is the whole question

Question 9 (5+3 marks) This question asks about object diagrams. Please consider the following C# code. class Hobbit { BindingList shire = private string _name; new BindingList(); private Hobbit _uncle; listBox_.DataSource = shire; public Hobbit(string n) {_name = n;} Hobbit h1 = new Hobbit("Bilbo"); public Hobbit(string 1, Hobbit u) { shire.Add(h1); _name = n; _uncle = u; } Hobbit h2 = public Hobbit Uncle { new Hobbit("Frodo", hi); get { return _uncle; } shire. Add (h2); set { _uncle = value; } h1 = new Hobbit("Sam", h2); } shire.Add(hi); public override string ToString() { h2 - 52. Uncle; return _name + " [" + Uncle._name + "]"; h2. Uncle = h1; } shire. Add (h2); a) Please draw an object diagram that shows the variables and objects in existence and their interconnections after execution of the C# code to the right. b) Assume the variable listBox references a list box that is displayed in a form. Please show the contents of this list box after execution of the code. Question 9 (5+3 marks) This question asks about object diagrams. Please consider the following C# code. class Hobbit { BindingList shire = private string _name; new BindingList(); private Hobbit _uncle; listBox_.DataSource = shire; public Hobbit(string n) {_name = n;} Hobbit h1 = new Hobbit("Bilbo"); public Hobbit(string 1, Hobbit u) { shire.Add(h1); _name = n; _uncle = u; } Hobbit h2 = public Hobbit Uncle { new Hobbit("Frodo", hi); get { return _uncle; } shire. Add (h2); set { _uncle = value; } h1 = new Hobbit("Sam", h2); } shire.Add(hi); public override string ToString() { h2 - 52. Uncle; return _name + " [" + Uncle._name + "]"; h2. Uncle = h1; } shire. Add (h2); a) Please draw an object diagram that shows the variables and objects in existence and their interconnections after execution of the C# code to the right. b) Assume the variable listBox references a list box that is displayed in a form. Please show the contents of this list box after execution of the code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!