2/27/2024 0 Comments Oops languagesData abstraction refers to providing only essential information about the data to the outside world, hiding the background details or implementation. Abstraction means displaying only essential information and hiding the details. To know more about encapsulation, refer to this article – Encapsulation in C++ Abstractionĭata abstraction is one of the most essential and important features of object-oriented programming in C++. In the above example, the data of any of the sections like sales, finance, or accounts are hidden from any other section. Here the data of the sales section and the employees that can manipulate them are wrapped under a single name “sales section”.Įncapsulation also leads to data abstraction or data hiding. He will first have to contact some other officer in the sales section and then request him to give the particular data. In this case, he is not allowed to directly access the data of the sales section. Now there may arise a situation when for some reason an official from the finance section needs all the data about sales in a particular month. Similarly, the sales section handles all the sales-related activities and keeps records of all the sales. The finance section handles all the financial transactions and keeps records of all the data related to finance. Consider a real-life example of encapsulation, in a company, there are different sections like the accounts section, finance section, sales section, etc. In Object-Oriented Programming, Encapsulation is defined as binding together the data and the functions that manipulate them. In normal terms, Encapsulation is defined as wrapping up data and information under a single unit. To know more about C++ Objects and Classes, refer to this article – C++ Classes and Objects Encapsulation Objects can interact without having to know details of each other’s data or code, it is sufficient to know the type of message accepted and the type of response returned by the objects. Each object contains data and code to manipulate the data. When a program is executed the objects interact by sending messages to one another. Objects take up space in memory and have an associated address like a record in pascal or structure or union. Software Engineering Interview Questions.Top 10 System Design Interview Questions and Answers.Top 20 Puzzles Commonly Asked During SDE Interviews.Commonly Asked Data Structure Interview Questions.Top 10 algorithms in Interview Questions.Top 20 Dynamic Programming Interview Questions.Top 20 Hashing Technique based Interview Questions.Top 50 Dynamic Programming (DP) Problems.Top 20 Greedy Algorithms Interview Questions. Top 100 DSA Interview Questions Topic-wise.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |