answersLogoWhite

0

A class is a description of an object, its attributes, and its methods. Its not a lot different than primitive types, such as int. int a; /* instantiate object of type int and call it a */ person b; /* instantiate object of type personand call it b */ The difference is that person is declared in a class specification, and is potentially much more complex than int. Still, you can think of both in the same context. The attributes (member variables) of a class contain the state of each instance of that class. You can (and usually do) declare those attributes as private, which means that only methods of the class can access them. This is data hiding. With data hiding, you can encapsulate the functionality of a class, exposing only the needed public interface. This way, if you need to change the way a class works internally, such as storing the person's name in unicode string instead of char string, that change can, if the interface is correct, be totally transparent to the user of the class.

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

Data hiding in oops?

Possible. More precisely, it is data-protection.


What is the difference between data hidding and data abstraction?

Abstraction: Abstraction refers to removal/reduction of irrelevant data or unnecessary data or confidential data from a Class. Data hiding: Data hiding is a feature provided by the abstraction for hiding the data from the class.


In ANSI C you can hide data by using private access specifier Justify?

One can always declare a datatype as static which will limit the scope to the file only. this way data hiding can be achived. For more clearance on the same please refer 'the C programming language'. Data hiding means only relevant data is visible to the user and all the background information is hidden from the user. In c++, the variables are named as data members and these can be hidden with the help of private access specifier. In procedural languages, variables(global variables) are free to flow from functions to functions and hence they were not secured. But in C++, only the class in which the data members are being declared can access them by using private specifier. As, the data members and also member functions of a class cannot be accessed outside the class if they have private access so, they get hidden from the user and hence the data hiding is achieved. Also in inheritance when we derive a class from the base class then the derived class cannot access the private members of the base class. In addition, if a class is derived from another class privately i.e. for example syntax : class B : private A , is used then all the public and protected members (not private) becomes private to class B and cannot be accessed outside the class B, even by using the object of class B. Hence, data hiding is achieved in C++ through private access specifier.


How data hiding is achieved in java?

Data hiding in the java is achieved through the use of encapsulation.


Why encapsulation does not implement information hiding in object orientation?

Encapsulation also implements data hiding in an object oriented programming design. By encapsulating various methods & data objects into a single class they can also be hidden from all the other classes. You can declare the variables and methods as private and that way you can hide the data from the other classes in the application.

Related Questions

Data hiding in oops?

Possible. More precisely, it is data-protection.


What is Data Hiding in VBNET?

Data hiding is used method used in Object-Oriented programing to hide information within computer code


What are the benefits of data hiding?

Data hiding enhances security by restricting access to sensitive information, reduces complexity by encapsulating data within a class or module, and promotes modularity by allowing different components to interact without revealing internal details. It also helps in maintaining code integrity and avoiding unintended data manipulation.


What is the difference between data hidding and data abstraction?

Abstraction: Abstraction refers to removal/reduction of irrelevant data or unnecessary data or confidential data from a Class. Data hiding: Data hiding is a feature provided by the abstraction for hiding the data from the class.


What is data hidding in oop?

Data hiding in OOP refers to the practice of hiding the internal state of an object from the outside world. This is achieved by encapsulating the data within the object and only allowing access to it through specified methods, known as getters and setters. By hiding the data, we protect it from being modified unintentionally and improve the integrity of the object's internal structure.


What term in java is used to indicate that a class's internal state is hidden from its clients?

Encapsulation............Hiding the data from others


In ANSI C you can hide data by using private access specifier Justify?

One can always declare a datatype as static which will limit the scope to the file only. this way data hiding can be achived. For more clearance on the same please refer 'the C programming language'. Data hiding means only relevant data is visible to the user and all the background information is hidden from the user. In c++, the variables are named as data members and these can be hidden with the help of private access specifier. In procedural languages, variables(global variables) are free to flow from functions to functions and hence they were not secured. But in C++, only the class in which the data members are being declared can access them by using private specifier. As, the data members and also member functions of a class cannot be accessed outside the class if they have private access so, they get hidden from the user and hence the data hiding is achieved. Also in inheritance when we derive a class from the base class then the derived class cannot access the private members of the base class. In addition, if a class is derived from another class privately i.e. for example syntax : class B : private A , is used then all the public and protected members (not private) becomes private to class B and cannot be accessed outside the class B, even by using the object of class B. Hence, data hiding is achieved in C++ through private access specifier.


How can you hide a photo within a photo?

Yes - the technique is called steganography, which is the practice of hiding data within image files. However, the process is not practical for hiding multiple messages or images within images - the clue for anyone viewing the data is an unusually large image file. If privacy is a concern, encryption would be a better avenue to pursue.


Is it possible to move data within accumulator?

we use LDA ## where ## is an 8 bit hexadecimal data


How data hiding is achieved in java?

Data hiding in the java is achieved through the use of encapsulation.


What does it mean by encapsulation?

Encapsulation makes class fields private, preventing access to it from outside of the class. Essentially, this data is hidden from the rest of the program. It is possible to allow access to the fields via public methods.


Why encapsulation does not implement information hiding in object orientation?

Encapsulation also implements data hiding in an object oriented programming design. By encapsulating various methods & data objects into a single class they can also be hidden from all the other classes. You can declare the variables and methods as private and that way you can hide the data from the other classes in the application.