Please mail your requirement at [email protected] Duration: 1 week to 2 week. Next Topic. Reinforcement Learning. R Programming. React Native. Python Design Patterns. Python Pillow. Python Turtle. Verbal Ability. Interview Questions. Company Questions. Artificial Intelligence. Cloud Computing. Data Science. So data abstraction is an OOP feature. My question is: does C also support data abstraction?
If so, why is data abstraction an Object Oriented Programming language feature and not a procedural language feature? If the answer to my question is no , then what about structures, enums in C? They also hide details from users. It's certainly possible to do object oriented programming in C. Remember that e. The thing that sets so called OOP languages apart from other is better support for these constructs, for instance in syntax.
One common way to provide abstraction is function pointers. This is an example of abstraction in C. See this article to read more about this particular example. Another form of data abstraction is opaque pointers.
An opaque data type is declared in a header file, but the definition is never exposed. Code that doesn't know the definition of the type can never access it's value, only use pointers to it. See Opaque data type and Opaque pointer on Wikipedia. An example of an opaque data type you've probably encountered is FILE from stdio. File Handling. Table of Contents. Save Article. Improve Article. Like Article. Recommended Articles. Article Contributed By :.
Easy Normal Medium Hard Expert. Writing code in comment? Please use ide. When is copy constructor called? Abstraction means displaying only essential information and hiding the details. Data abstraction refers to providing only essential information about the data to the outside world, hiding the background details or implementation. Consider a real life example of a man driving a car. The man only knows that pressing the accelerators will increase the speed of car or applying brakes will stop the car but he does not know about how on pressing accelerator the speed is actually increasing, he does not know about the inner mechanism of the car or the implementation of accelerator, brakes etc in the car.
This is what abstraction is.
0コメント