Inherits them from the person class notice that a

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: ds even though they aren’t explicitly defined in the class. • Inherits them from the Person class. • Notice that a Student object has access to the instance variables of other Student objects (e.g., for equals). CS133 Course Notes Lecture 14, Slide 17 Example > Student troy = new Student("Troy", 20000001); > Student sandy = new Student("Sandy", "200 King St", 99); > System.out.println(troy.getName()); ___________________ > System.out.println(troy.calcFees()); ___________________ > troy.setName("Troy Vasiga"); > System.out.println(troy.sameName(sandy)); ___________________ > sandy.addCourse("CS 000"); > System.out.println(sandy.calcFees()); ___________________ > sandy.getStudentID(); ____________________ CS133 Course Notes Lecture 14, Slide 18 17 18 Overriding methods • Sometimes w...
View Full Document

Ask a homework question - tutors are online