Bifalgorithm post · Computer science one · Encapsulation & Objects

How does encapsulation group and protect related data?

How does encapsulation group and protect related data? (Computer science one · Encapsulation & Objects) — "The solution is to encapsulate the pieces of data in…

Ideas in this flowchart

  • Encapsulation organizes data and related operations into a logical entity.
  • The logical entity is sometimes referred to as an object.
  • Encapsulation groups pieces of data with the functions that operate on them.
  • Encapsulation can protect data by controlling its visibility from code outside the object.
  • An array is also a collection of data, but it differs from an object.
  • An array usually contains pieces of similar data, such as integers or floating-point numbers.
  • An object may collect dissimilar data that together form a larger entity.
  • The difference resembles the distinction between rows and columns in a table.
  • In student data, each row represents a record and each column represents a data field.
  • An identification number may be modeled as a string because it can contain dashes and begin with zeros.
Feed/

How does encapsulation group and protect related data?

No cover

Channel

Computer science one

1 page

"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"

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.