What is the primary difference between abstraction and encapsulation in C++?
- Abstraction hides details; encapsulation bundles them.
- Abstraction uses inheritance; encapsulation doesn't.
- Abstraction is a data type; encapsulation is a method.
- Encapsulation is a principle; abstraction is an attribute.
The primary difference between abstraction and encapsulation in C++ lies in their purposes and implementations. Abstraction focuses on hiding the complex reality of an object and showing only the necessary features, essentially giving a high-level view. On the other hand, encapsulation is about bundling data and the methods, shielding them from outside interference.
Loading...
Related Quiz
- A function that calls itself directly or indirectly is known as a _______ function.
- The first commercially available C++ compiler was named _______.
- An exception thrown by a function in the _______ block can be caught in the subsequent catch block.
- Which operator is used to access the memory address of a variable in C++?
- In C++ STL, which algorithm is most suitable for rearranging elements in a range, so they are in reversed order?