Question: C: Class Inheritance [10 marks] Consider the following QQ class: public class QQf public int q; public QQ(int q) this.q = q; The intention is
![C: Class Inheritance [10 marks] Consider the following QQ class: public](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f2f5232162b_49866f2f5228f780.jpg)
C: Class Inheritance [10 marks] Consider the following QQ class: public class QQf public int q; public QQ(int q) this.q = q; The intention is that objects of this class have some state (the attribute q) that once set cannot be changed. First rewrite this class so that (a) the value of q can never be changed, and (b) it uses information hiding. Add any appropriate getters/setters. Next, write a new class WW that extends the class QQ. The new class should (c) introduce a new attribute (a String labeled w) and have a constructor that takes an integer (for q) and a String (for w) as input and sets the state of the object approriately
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
