Flux rss

OOP - Data encapsulation

Object-Oriented Programming (OOP)

The concept of encapsulation

Encapsulation is a way of organising data and methods into a structure by concealing the the way the object is implemented, i.e. preventing access to data by any means other than those specified. Encapsulation therefore guarantees the integrity of the data contained in the object.

Concealing data

The user of a particular class does not need to know how the data in that object is structured, this means that a user does not need to know how implementation takes place. By preventing the user from directly modifying attributes, and forcing the user to use defined functions in order to modify them (called interfaces), data integrity is thus ensured (for example, one can ensure that the data type given matches expectations, or is returned within the expected time interval).

Encapsulation defines the access levels for elements of that class. These access levels define the access rights to the data, allowing us to access the data by a method of that particular class itself, from an inheritance class, or even from any other class. There are three levels of access:

  • public: functions of all classes may access the data or methods of a class that is defined with the public access level. This is the lowest level of data protection
  • protected: data access is restricted to functions of inheritance classes, i.e. member functions of that class and all sub-classes
  • private: data access is restricted to methods of that particular class only. This is the highest level of data protection


Last update on Thursday October 16, 2008 02:43:13 PM.
This document entitled « OOP - Data encapsulation » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the licence, as this note appears clearly.
Data transmission - Introduction The purpose of a network is to transmit information from one computer to another. To do this, you first have to decide how to encode the data to be sent, in other words its computer representation. This will differ according to the type of data,... en.kioskea.net/transmission/transintro.php3
Data transmission - Cabling Several physical data-transmission media are available to connect together the various devices on a network. One possibility is to use cables. There are many types of cables, but the most common are: Coaxial cable Double twisted pair Optical fibre... en.kioskea.net/transmission/transcabl.php3
Databases - DBMS models Databases appeared in the late 1960s, at a time when the need for a flexible information management system had arisen. There are five models of DBMS, which are distinguished based on how they represent the data contained: The hierarchical model: The... en.kioskea.net/bdd/bddtypes.php3
Backup Outlook 2003 dataBackup Outlook 2003 data All Outlook 2003 data ( Emails, Agenda, Contacts, Tasks...) are in one file with .pst extension The file is in the following default folder: C:\Documents and Settings\Login\Local Settings\Application... en.kioskea.net/faq/sujet-47-backup-outlook-2003-data
[Ingres] Importing/ Exporting data[Ingres] Importing/ Exporting data Making use of these commands copydb unloaddb Notes Ingres allows you to export data from an Ingres installation to another (it is a platform independent procedure). unloaddb copydb The main... en.kioskea.net/faq/sujet-964-ingres-importing-exporting-data
Connecting to an Ingres database with PHPConnecting to an Ingres database with PHP Getting started Download PECL Installation Windows Linux & Unix Getting connected This tip is based on following Ingres documentation: Getting started Ingres ® 2006 Release 2 for... en.kioskea.net/faq/sujet-923-connecting-to-an-ingres-database-with-php
MySQL Help, PHP and Database help (Solved)Hello, I am building a form/blog/personal site for a small company. I was wondering if someone could help me in setting up my database. i have thought of a few options but i am not quite sure what one is the best. each user have a person page, they... en.kioskea.net/forum/affich-21728-mysql-help-php-and-database-help
How to merge an excel file to database? (Solved)Could someone please instruct me how to merge an excel file to database (MS Access/FoxPro/Oracle)? en.kioskea.net/forum/affich-19483-how-to-merge-an-excel-file-to-database
Excel: Remove data to another sheetHello, I got a bit of an Excel query that I am struggling with. Say you have two worksheets - Data1 and Data2. Both sheets will have identical columns and column headings. But Data1 will be the main sheet where all the data is inputted to, save for... en.kioskea.net/forum/affich-14241-excel-remove-data-to-another-sheet
Download Zilla Data NukerBy abolishing files or sensitive or contaminated files, it is possible that fragments stay on the hard disk. These rags can again harm your system if they are not correctly abolished. Zilla Data Nuker abolishes not used files which take of the place... en.kioskea.net/telecharger/telecharger-506-zilla-data-nuker
Download Database Designer Platinum EditionDatabase Designer is a program for creating databases. It requires no programming knowledge. The application offers many tools: additions of fields, images, checks bugs correction syntactic and much more. It also allows the export of basic HTML, text... en.kioskea.net/telecharger/telecharger-1077-database-designer-platinum-edition
Google hands over data on suspected pedophiles to BrazilThe website Orkut from Google is displayed on a screen in a cybercafe in Brasilia, on April 9. Google on Wednesday handed over data stored by suspected pedophiles on its Orkut social networking site to Brazilian authorities, ceding to pressure to... en.kioskea.net/actualites/google-hands-over-data-on-suspected-pedophiles-to-brazil-10315-actualite.php3
US-EU private data sharing agreement at hand: reportFile photo shows a United Airlines flight attendant serving passengers. The United States and European Union are close to an agreement to share private data of their citizens, including credit card information, travel history and internet browsing... en.kioskea.net/actualites/us-eu-private-data-sharing-agreement-at-hand-report-10494-actualite.php3
Facebook suffers first drop in British users: dataFacebook, the Internet social networking site, has suffered its first drop in British users in 17 months, according to data from web monitoring firm Nielsen Online. Facebook, the Internet social networking site, has suffered its first drop in British... en.kioskea.net/actualites/facebook-suffers-first-drop-in-british-users-data-10141-actualite.php3
Data transmission - Analogue transmission Analogue data transmission consists of sending information over a physical transmission medium in the form of a wave. Data is transmitted via a carrier wave, a simple wave whose only purpose is to transport data by modification of one of its... en.kioskea.net/transmission/transanalog.php3
Spreadsheets - Data Entry A cell of a worksheet can contain a value or be empty. The value of a cell has two essential characteristics: a type, which means the intrinsic type of the data. There are generally three types of values: numeric values, for example 3.1415927, 58%,... en.kioskea.net/tableur/tabsaisie.php3
Databases - ODBC (Open Database Connectivity) ODBC stands for Open Database Connectivity. This is a Microsoft-defined format for communicating between Windows database clients and consumer DBMSs. The ODBC managier can be found in Windows 3.1 and 9x. In Windows 95 and 98, it is available in the... en.kioskea.net/bdd/odbc.php3