07-07feb13stepwiseRefinement

In that construct as well as names that appear in

This preview shows page 1 - 2 out of 2 pages.

in that construct, as well as names that appear in enclosing constructs (unless a name is declared twice, in which case the closer one prevails). File drawer for class Elephant setName(String n) { name= n; } Elephant a0 n Elephant Pop name setName(String n) { name= n; } Elephant a0 n name 4 Inside-out rule Inside-out rule in most programming languages (see p. 83): Code in a construct can reference any of the names declared or defined in that construct, as well as names that appear in enclosing constructs (unless a name is declared twice, in which case the closer one prevails). File drawer for class Elephant Elephant Pop setName(String name) { name= name; } Elephant a0 name name setName(String name) { name= name; } Elephant a1 name name 5 About using this and super Within an object, this refers to the name of the object itself, File drawer for class Elephant Elephant Pop setName(String name) { this. name= name; } Elephant a0 name name setName(String name) { this. name= name; } Elephant a1 name name In folder a0, this refers to folder a0. In folder a1, this refers to folder a1. 6 About using this and super Within a subclass object, super refers to the object —except the lowest partition.
Image of page 1

Subscribe to view the full document.

Image of page 2
You've reached the end of this preview.
  • Spring '07
  • DAVIDGRIES

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern