Questions tagged [data-hiding]
60 questions
61
votes
20 answers
Encapsulation vs Data Hiding - Java
Interviewer: What is encapsulation and how do you achieve it in Java?
Me: Encapsulation is a mechanism to hide information from the client. The information may be data or implementation or algorithm. We
achieve this using access modifiers.…

Sandeep Jindal
- 14,510
- 18
- 83
- 121
13
votes
4 answers
Are static variables inherited
I have read at 1000's of locations that Static variables are not inherited. But then how this code works fine?
Parent.java
public class Parent {
static String str = "Parent";
}
Child.java
public class Child extends Parent {
…

Aman
- 979
- 3
- 10
- 23
4
votes
2 answers
Practical example Encapsulation vs Information Hiding vs Abstraction vs Data Hiding in Java
I know there are lots of post regarding this question which has theoretical explanation with real time examples.These OOPs terms are
very simple but more confusing for beginners like me.
But I am expecting here not a definition and real time…

Prashant Shilimkar
- 8,402
- 13
- 54
- 89
3
votes
2 answers
A precise explanation of encapsulation, data abstraction and data hiding
The object oriented concepts : encapsulation, data abstraction and data hiding are 3 different concepts, but very much related to each other. So i am having difficulty in understanding the concepts fully by reading the information from internet. The…

nitin_cherian
- 6,405
- 21
- 76
- 127
3
votes
4 answers
In OOP is class encapsulation the right way to do data hiding?
I have a question about the OOP principle of data hiding.
As far as I understand,
data hiding = restrict internal fields of a structure to a certain area of visibility.
Motivation: if one changes structure contents, only implementations in the area…

jam
- 803
- 5
- 14
3
votes
5 answers
Abstraction and Data Hiding in java
I'm trying to understand the concept of abstraction in java. When I came through some tutorials they said that Abstraction is a process where you show only “relevant” data and “hide” unnecessary details of an object from the user.
This is a…

Dil.
- 1,996
- 7
- 41
- 68
3
votes
3 answers
Public sizeof for privately defined struct
I have a little data-hiding module that looks like this:
/** mydata.h */
struct _mystruct_t;
typedef struct _mystruct_t mystruct;
mystruct *newMystruct();
void freeMystruct( mystruct** p );
/** mydata.c */
#include "mydata.h"
struct _mystruct_t {
…

Luis
- 1,210
- 2
- 11
- 24
2
votes
4 answers
Hiding C struct definition
Here is my setup:
In public.h:
#ifndef PUBLIC_H_
#define PUBLIC_H_
#include "func.h"
/*extern typedef struct _my_private_struct PRIVATE_;*/
typedef struct _my_private_struct PRIVATE_; /* Thanks to larsmans and Simon Richter */
#endif
In…

markfw
- 683
- 2
- 9
- 22
2
votes
9 answers
JAVA - Abstraction
I am little confused about abstraction in java.
I have checked many pages stating that abstraction is data hiding(Hiding the implementation).
What I understand about abstraction is it is 'partial implementation'. Just define what you are going to…

Half Blood Prince
- 951
- 2
- 13
- 25
2
votes
1 answer
[Steganography ]Hiding Data in PDF files
I'm trying to hide a file in a PDF file code. I've already search some information to help me. I've tried to uncompress the pdf using pdftk ( pdftk pdf.pdf output uncompress.pdf uncompress ). Then I tried different things such as :
Insert…

Prygan
- 95
- 1
- 9
2
votes
0 answers
A JavaScript Concatenator library to achieve data hiding under modularization
JavaScript Concatenator
I'm considering writing a JavaScript library to achieve Data Hiding under Modularization. I hope to get some inputs on whether this will be useful and what are the potential problems.
Let's me explain the problem first. What…

Boyang
- 2,520
- 5
- 31
- 49
2
votes
5 answers
Inlined Setter and Getter functions in C
In C++ I can have a getter function declared inline in a header file:
class Cpp_Example
{
public:
unsigned int get_value(void)
{ return value;}
private:
unsigned int value;
};
By including this header file, client methods and…

Thomas Matthews
- 56,849
- 17
- 98
- 154
2
votes
1 answer
separable image encryption and data hiding
I am developing a project " separable reversible data hiding in encrypted image" based on an ieee paper in java. I understood how to encrypt the image but cant really understand how the data is embedded in the image by modifying the LSB. Can someone…

Amar C
- 374
- 5
- 17
1
vote
2 answers
Parent - Child Relation in C++
Consider the below C++ code
class B;
class A{
private:
B* mB;
};
class B{
private:
doSomethingImportant();
};
We have a Object A that contains (has a) Object B. The parent being A and child being B. Now if I want A to make B do…

bsoundra
- 930
- 2
- 13
- 27
1
vote
4 answers
Hiding mutators, clarification needed
Suppose you have a class Dog, that has
public class Dog {
private String name;
private double age;
// some setters
// some getters
Additionally, you have a class DogHandler, that makes an instance of the Dog d and passes it to…

James Raitsev
- 92,517
- 154
- 335
- 470