Concept

How does encapsulation group and protect related data?

ComputerScienceOne / Encapsulation & Objects

"The solution is to encapsulate the pieces of data into one logical entity, sometimes referred to as an object . More formally, encapsulation is a mechanism by which pieces of data can be grouped together along with the functions that operate on that data. Encapsulation may also provides a means to protect that data by controlling the visibility of that data from code outside the object. Contrast this with an array which is also a collection of data. However, an array usually contains pieces of similar data (all elements are integers or all elements are floating point numbers) while an object may collect pieces of dissimilar data that make up a larger entity. It is like the difference between rows and columns in a table. Consider the student data in Table 10.1. Each row represents a record while each column represents a 1 Depending on the identification number, it may be more appropriately modeled with a string. Social Security Numbers for example are not purely numeric; they include dashes and may begin with zeros. 197"

Related Ideas

How does encapsulation group and protect related data? | ComputerScienceOne | Bifalgorithm | Bifalgorithm