lecture12

lecture12 - PIC 20A Lecture 12: Access Control Specifiers...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
PIC 20A Lecture 12: Access Control Specifiers Polymorphism
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Access Control Specifiers public - makes the member accessible to method definitions of its own class or to an object reference of its class via the dot operator (.) protected - an intermediate level of access between public and private . private - makes the member accessible only to method definitions of its own class
Background image of page 2
What does protected mean? • A superclass's protected member may be accessed only by – methods of the superclass, – methods of subclasses, – methods of other classes in the same package
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
What is package access? • another intermediate form of privacy • given to fields or methods for which no member access modifier is provided. • any other class living in the same package can directly access package access members through a reference to an object having those members
Background image of page 4
Why package access? • enables objects of different classes to interact without the need for set and get methods • reduces function call overhead
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Recall Person and Student classes public class Person { protected String _name; protected int _age;
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/12/2010 for the course PIC PIC 20A taught by Professor Keithouellette during the Spring '09 term at UCLA.

Page1 / 18

lecture12 - PIC 20A Lecture 12: Access Control Specifiers...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online