lec18Feb1308

Lec18Feb1308 - Lecture 18 Encapsulation An object can be thought of as a black box Inner workings are hidden to the client The client only invokes

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

View Full Document Right Arrow Icon
Lecture 18 February 13, 2008
Background image of page 1

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

View Full DocumentRight Arrow Icon
Encapsulation An object can be thought of as a black box Inner workings are hidden to the client The client only invokes the interface methods
Background image of page 2
Encapsulation Hiding data and methods within an object Accomplished through appropriate use of public and private (visibility modifiers) Private : Only accessibly through the methods defined for the class Can only be modified by calling a (specified) method of the class that does that Important for security and ensuring integrity of class objects
Background image of page 3

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

View Full DocumentRight Arrow Icon
Two views of an object Internal Structure of the data Algorithms used by its methods External The interaction of the object with other objects in the program
Background image of page 4
External View An object is an encapsulated entity Provides a set of specific services These services define the interface to the object An object is an abstraction that hides details from the rest of the system
Background image of page 5

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

View Full DocumentRight Arrow Icon
An object should be self-governing
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/14/2008 for the course COMP 202 taught by Professor Verbrugge during the Winter '07 term at McGill.

Page1 / 11

Lec18Feb1308 - Lecture 18 Encapsulation An object can be thought of as a black box Inner workings are hidden to the client The client only invokes

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