Chapter3_1-ClassesAndObjects

By preventing from accessing data in a nonintended

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: A. TOUIR Introduction to OOP Encapsulation Gives Classes • OOP makes use of encapsulation to ensure that data is used in an appropriate manner. – by preventing from accessing data in a nonintended manner (e.g. asking if an Integer is true or false, etc.). • • Through encapsulation, only a predetermined appropriate group of operations may be applied (have access) to the data. Place data and the operations that act on that data in the same class. Page 11 • Encapsulation is the OO principle that allows objects to contain the appropriate operations that could be applied on the data they store. – My Nokia-N71 cell-phone stores: • My contacts, • Missed calls • … etc. – My Nokia-N71 may perform the following operations on the data it contains: • Edit/Update/Delete an existing contact • Add a new contact • Display my missed calls. • …etc. Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP UML Representation of a Class • UML represents a class with a rectangle having 3 compa...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online