Object Concepts and Terminology-2

Tostring author author n

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: package and by inheritance Available within the current package A subclass can always access the public and protected members of its parent class, someDmes package, but not private members. Superclasses, Subclasses, and Polymorphism CreaDng a Superclass (Parent) public Product( ) { private String code, name, descripDon; Product( ) { code, name, descripDon = “”; } public String toString( ) { return = “Name: “ + name + “\n” + “DescripDon: “ + descripDon + “\n”; } } Superclasses, Subclasses, and Polymorphism CreaDng a Subclass (Child) public Book(...
View Full Document

Ask a homework question - tutors are online