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

16y 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 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 Data Hiding in VBNET?

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


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.


When a data field is private it is said to be unreachable?

When a data field is private, it is encapsulated within a class and cannot be accessed directly from outside that class. This concept is fundamental in object-oriented programming, as it promotes data hiding and protects the integrity of the object's state. As a result, the private field is considered "unreachable" from external code, reinforcing the idea that access to the data should occur through public methods or properties defined in 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.


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.


How data hiding is achieved in java?

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


Is it possible to move data within accumulator?

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

Trending Questions
Who is john connor's father? Is Java-script a high level programming language? A differential pressure transmitter is to be calibrated to read level of a closed vessel The dimensions of the closed vessel are as given below What would be the calibration range of the transmitter? What value of capacitor for 2hp acu compressor? What is inbound coach operator do? Can interface implement the other interface? How will you initialize a 2-d array? How does one indicate that certain text is to be treated as a comment in the classic C language? Design an algorithm that prompts the user to enter his or her height and stores the user's omit om a variable named height? Can you run a 1500w power tool on a 3kvA 240W to 110W step down transformer? If a 9-v radio requires 200 mA to operate and in order to operate the radio from a 12-v battery at the same current what size resistor must be connected in series with it? What is 0.8 bar pressure? Why are pillars there on a arch bridge? Who should pay a bank wire fee in a transferfence? Programme to write positive numbers until the user enters no and then sum the numbers divisible by 4 that lie between the range of 10 and 50 and finally display the count and the average value? What is use of HREF attribute? What are the disadvantages of Practical work approach? Which element of array does this expression refer num5? Why can't you use a hand pump to lift water to the 3rd floor of an apartment complex? What is meant by bressless DC motor?