answersLogoWhite

0


Best Answer

Data abstraction refers to the way users can interact with class data without needing to know how that data is stored or manipulated by the class. For instance, a class method such as int GetValue() will obviously return an integer, but the value from which that integer comes need not be an integer (it could be a float) or it could be calculated on the fly based upon other internal data members. The point is that it is irrelevant to the user how the value was obtained.

Although many will tell you that data hiding (or information hiding) refers to the way in which classes "hide" private or protected information within themselves, that is not the case at all. What they are really referring to is data abstraction, as outlined above.

Note that private or protected access only limits access to the information, it does not physically hide it in any way, shape or form. That is, a private data member can be thought of as being placed in a virtual cage: your compiler can see the member exists, but unless your code is a member of the class then you cannot access it, and the compiler will tell you as much. The following example demonstrates the concept:

class a {

private: int data; };

class b: public a {

void foo { a::data = 5; }

}

In the above example, a::data is clearly visible and nothing can physically prevent you from writing the code shown above. Your compiler will obviously tell you that a::data is not accessible from b, but in order to do so the compiler must know that a::data exists. And if the compiler knows it exists, then so do you, even if the declaration appears in another file, thus the data cannot be said to be hidden.

The true meaning of data hiding is the way in which a binary executable or library hides information from the user. That is, the information is hidden through obfuscation. A skilled disassembler can still reveal the internal details so it is not completely hidden, but it would be difficult, if not impossible, even for a skilled disassembler, to reconstruct the original classes from which that data was produced, unless they have access to the declaration.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is data abstraction and data hiding concept in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What c plus plus programming statements to implement data abstraction?

Data abstraction is a design concept, whereby interfaces and implementations are kept separate. That is, it should not be necessary to know how an object works in order to use it. The interface provides all you need to know. This reflects much of real life. When watching TV, you have a remote control which allows you to select a channel, but it is not necessary to know how the TV receives and processes radio signals, nor how it separates one channel from another. Those are implementation details that are only of concern to TV engineers. In C++, there are no statements as such to implement data abstraction. You achieve it by designing a public interface which is accessible to normal users, and a private interface that is only accessible to the class designer.


What is meant by abstraction in c plus plus?

Abstraction is a process by which higher concepts are derived from the usage and classification of literal ("real" or "concrete") concepts, first principles and/or other abstractions.


Is there anything similar between C and C plus plus with reference to data hiding?

No. Data hiding is a feature of object oriented programming. C does not support OOP, and therefore has no private member access. All members are public in C.


What are the main features of OOP in c plus plus?

The main features of OOP are the same regardless of the language. They are: encapsulation; data hiding; inheritance; and polymorphism.


Why c plus plus called as paritial oop?

C++ is only partially OOP because it is a superset of C and, for the sake of backward compatibility, retains the concept of primitive data types (such as integrals like char and int) and pointer data types, which are all strictly non-object-oriented. In Java and C#, there is no concept of a primitive data type. Even integral types such as int are treated as objects and there is no concept of a pointer data type.

Related questions

What c plus plus programming statements to implement data abstraction?

Data abstraction is a design concept, whereby interfaces and implementations are kept separate. That is, it should not be necessary to know how an object works in order to use it. The interface provides all you need to know. This reflects much of real life. When watching TV, you have a remote control which allows you to select a channel, but it is not necessary to know how the TV receives and processes radio signals, nor how it separates one channel from another. Those are implementation details that are only of concern to TV engineers. In C++, there are no statements as such to implement data abstraction. You achieve it by designing a public interface which is accessible to normal users, and a private interface that is only accessible to the class designer.


What is meant by abstraction in c plus plus?

Abstraction is a process by which higher concepts are derived from the usage and classification of literal ("real" or "concrete") concepts, first principles and/or other abstractions.


What is data hidening in c plus plus?

Data hiding is a property that only relevant information is exposed to the user and rest of the informations remains hidden from the user


Is there anything similar between C and C plus plus with reference to data hiding?

No. Data hiding is a feature of object oriented programming. C does not support OOP, and therefore has no private member access. All members are public in C.


What are the main features of OOP in c plus plus?

The main features of OOP are the same regardless of the language. They are: encapsulation; data hiding; inheritance; and polymorphism.


Why c plus plus called as paritial oop?

C++ is only partially OOP because it is a superset of C and, for the sake of backward compatibility, retains the concept of primitive data types (such as integrals like char and int) and pointer data types, which are all strictly non-object-oriented. In Java and C#, there is no concept of a primitive data type. Even integral types such as int are treated as objects and there is no concept of a pointer data type.


Why is C plus plus called an object oriented language?

It is called an OOP language because it supports the four pillars of the OOP paradigm: abstraction, encapsulation, inheritance and polymorphism. However, it is not 100% object oriented as it also supports the concept of primitive variables, including pointers, which are not implemented as objects.


Why c plus plus is not complete object oriented language?

because c++ supports all the basic concepts of oop :1.objects,2.classes,3.data abstraction and encapsulation,4.inheritance,5.polymorphism,6.dynamic binding,5.message passing.


Is there a file concept in c plus plus?

No. The standard does not define nor require a file concept.


What is concept in c which is not in c plus plus?

No such thing.


What is the Beje in the book The Hiding Place?

The actual hiding place for the Jews! Plus a work shop for watches...


What is the concept of asterisk in c plus plus?

An asterisk in C++, such as int *data, is what's known as a pointer. A pointer is like a regular variable, but instead of holding a value, a pointer holds the memory location of the value. It's a somewhat difficult concept, and you can learn more about it here: See related links section below...