473,508 Members | 2,333 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how data hiding differs in c++ and java

1 New Member
i am new to this c++ and java i want to know the difference between the concept of data hiding and encapsulation in both c++ and java
Oct 25 '07 #1
1 1759
weaknessforcats
9,208 Recognized Expert Moderator Expert
The concepts of data hiding and encapsulation are the same between C++ and Java.

Data hiding refers to placing the data in a restricted access where it is not available to everyone. This refers to the access specifiers private and protected. Any data with these specifiers is hidden. You use public functions to access these members.

Encalsulation refers to separating your interface from your implementaton. That is, your class inteface is constant and is never overridden by a derived class. The class interface is usually the public member functions of the class. The implementation (how you did it) is hidden. Typically, the implementation uses private virtual functions which are overridden by derived classes to obtain the tailored behavior. A properly encapsulated class permits a complete redesign without altering the signatures of the public methods. This translates to being able to redesign without changing any user code.
Oct 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

18
1856
by: Anchorman | last post by:
We have a customer that wants us to put our ASP application on their server, so they can have direct access to the database. However, we don't want to leave our code wide open for them to copy...
11
4168
by: Lorenzo Villari | last post by:
I premise I don't know C++ well but... I wondered what is this data hiding thing... I mean, if I can look at the header (and i need it beacuse of the class), then what's hidden? Can someone give...
9
4617
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
2
2373
by: coolwarrior | last post by:
Hi, 1_I want to know the difference between "data hiding" , "steganography" ,"watermarking" ,"capsulation" related to DSP. 2_There r plenty of informaion about data hiding for images on the web...
28
3381
by: Act | last post by:
Why is it suggested to not define data members as "protected"? Thanks for help!
63
2612
by: time.swift | last post by:
Coming from a C++ / C# background, the lack of emphasis on private data seems weird to me. I've often found wrapping private data useful to prevent bugs and enforce error checking.. It appears...
2
7612
by: subramanian100in | last post by:
Is my following understanding correct ? Data abstraction means providing the interface - that is, the set of functions that can be called by the user of a class. Information hiding means...
162
10065
by: Sh4wn | last post by:
Hi, first, python is one of my fav languages, and i'll definitely keep developing with it. But, there's 1 one thing what I -really- miss: data hiding. I know member vars are private when you...
0
841
by: Samuel Bayer | last post by:
Jonathan Gardner wrote: At the risk of prolonging this thread, I'll add my own personal insight. I've spent a decent amount of time programming in Java, and the overhead of assigning a...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7042
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7495
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5052
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3181
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1556
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.