In Widget
, the members x
and y
should be private
. They should not be exposed to the interface in such a way. You can either add the private
keyword above them, or just move the public
keyword below them (classesmembers are private
by default, so both are essentially the same).