Questions tagged [data-hiding]
54 questions
57
votes
19 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
- 11,766
- 17
- 76
- 117
9
votes
3 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
- 879
- 3
- 9
- 22
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
- 7,156
- 11
- 45
- 83
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
- 5,791
- 18
- 66
- 121
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
- 743
- 3
- 12
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,788
- 6
- 33
- 61
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,131
- 2
- 9
- 22
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
- 643
- 1
- 8
- 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
- 455
- 1
- 8
- 20
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,322
- 5
- 22
- 47
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
- 52,985
- 12
- 85
- 144
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
- 335
- 2
- 13
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
- 920
- 2
- 11
- 26
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
- 82,013
- 132
- 311
- 454
1
vote
1 answer
Is my basic obfuscation function correct ? (for hiding datas in a database)
I am asked to hide the email of the user in a database. (MEAN stack).
I am a newbie and I had some difficulties to manage some packages like maskdata, crypto.js... and at some point I have been inspired by a function.
In my code, for the user…
RafaRemote
- 31
- 1
- 8