Skip to content

Commit 9dbe958

Browse files
committed
Merge branch 'master' of https://github.com/bhoffman0/CSAwesome
2 parents 80078ed + 79c8cf2 commit 9dbe958

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

_sources/Unit9-Inheritance/topic-9-3-overriding.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ For example, if a parent class has a private instance variable, ``name``, then t
437437
:feedback_a: The object currItem is an EnhancedItem object and it will inherit the public setX method from Item.
438438
:feedback_b: The object currItem is an EnhancedItem object and that class has a public setY method.
439439
:feedback_c: Even though an EnhancedItem object will have a x field the subclass does not have direct access to a private field. Use the public setX method instead.
440-
:feedback_d: All code in the same class has direct access to all object fields.
440+
:feedback_d: The instance variable y is in the same class and set to public so it can be directly accessed.
441441

442442
Given the following class definitions which of the following would not compile if it was used in place of the missing code in the main method?
443443

@@ -456,7 +456,7 @@ For example, if a parent class has a private instance variable, ``name``, then t
456456
457457
public class EnhancedItem extends Item
458458
{
459-
private int y;
459+
public int y;
460460
461461
public void setY(int theY)
462462
{

0 commit comments

Comments
 (0)