Name newname thisaddress public personstring newname

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ring newName) { this.name = newName; this.address = ""; } public Person(String newName, String newAddress) { this.name = newName; this.address = newAddress; } CS133 Course Notes Lecture 14, Slide 9 The Person class public String getName() { return this.name; } public void setName(String newName) { this.name = newName; } public boolean sameName(Person other) { return this.name.equalsIgnoreCase( other.name); } // Also getAddress and setAddress and // sameAddress CS133 Course Notes Lecture 14, Slide 10 9 10 Person as Superclass • Person is called the superclass (or base class or parent class). • This is the most general class. • From this class, subclasses (or derived classes or child classes) can inherit properties (e.g., methods and attributes) from the super class. CS133 Course Notes Lecture 14, Slide 11 Person continued • Using the University hierarchy again, we will creat...
View Full Document

Ask a homework question - tutors are online