answersLogoWhite

0


Best Answer

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.

User Avatar

Wiki User

โˆ™ 2009-09-04 13:28:33
This answer is:
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
User Avatar
Study guides
๐Ÿ““
See all Study Guides
โœ๏ธ
Create a Study Guide

Add your answer:

Earn +20 pts
Q: In ANSI C you can hide data by using private access specifier Justify?
Write your answer...
Submit
Related questions

How the jvm is able to access your class even you declare it using default access specifier but the same class is not accessed from other class which is declared in another package?

The JVM knows about all of your classes, no matter what package they are in or what access specifier you declared them with. The access specifier is only used to limit access from other classes.


What is the use of public access specifier?

use of public access specifier iswe can access the class members(methods,variables) out side the class using class reference


When class will be used and when structure will be used?

In class default members are private and in structure default members are public ,When ever you want to hide data from outside functions then you can use class.But in ANSI C we can hide data by using private access specifier.


What is the difference between public and default specifier?

If you do not specify an access control modifier the compiler will use the default of whatever language you are using


Is it possible to access the private variable in CPP from outside the class?

Private variables can only be accessed from outside of a class by using any public function of that same class. Or this can be accomplished by using Friend functions.


How do you stop your neighbor from using your internet?

make it a private wireless internet by make it to where you have to put a password in to access it


If a network is using private IP addresses how can the computers on that network access the Internet?

They can't. Private IP addresses are IP addresses used on private intranets that are isolated from the Internet. If a networked computer with a private IP address uses a Network Address Translation, known as a NAT it can gain access to the Internet. Here's how it works. A NAT uses a public IP address to access the Internet for all the other computers on the network using private IP addresses. Using NAT, a networked computer trying to gain access to the Internet goes through a router or a server which then substitutes its own IP address for the private IP address on the computer that wants to connect to the Internet. The NAT acts as proxy for all the other computers that want Internet access which is why it is called a "proxy server".


What is visibility in Java?

Visibility is another term used for Acess Specifiers for java variables and objects.One of the techniques in object-oriented programming is encapsulation. It concerns the hiding of data in a class and making them available only through its methods. In this way the chance of making accidental mistakes in changing values is minimized. Java allows you to control access to classes, methods, and fields via so-called access specifiers. The access to classes, constructors, methods and fields are regulated using access modifiers i.e. a class can control what information or data can be accessible by other classes. To take advantage of encapsulation, you should minimize access whenever possible.Java provides a number of access modifiers to help you set the level of access you want for classes as well as the fields, methods and constructors in your classes. A member has package or default accessibility when no accessibility modifier is specified.Access Modifiers1. Private2. Protected3. Default4. PublicPublic is the most liberal access specifier and Private is the most restrictive access specifier.


How do you find flight details boarding from India to us using passenger name?

You - as a 'private citizen' have no right to access that information.


On a runescape private server how do you make infinite hitpoints into an item?

Well, that is totally dependent on what private server you are using. But in most, you simply edit the "health" code/access # for that item.


If you can Justify the choice of using the horizontal milling machine instead vertical milling machinefor making the baseplate?

Justify the using of the horizontal milling machine for making the baseplate


Which of the folllowing uses a single public IP address to access the Internet on behalf of all of the hosts on the network that may be using other IP addresses or private IP addresses?

•If the hosts on a network using private IP addresses need to access the Internet, a problem arises because the private IP addresses are not allowed on the Internet. •The solution is to use NAT (Network Address Translation), which uses a single public IP address to access the Internet on behalf of all hosts on the network using other IP addresses.


Describe the difference between public and private IP addresses If a network is using private IP addresses how can the computers on that network access the Internet?

If a network is using a public IP address, anyone can use it to log on to the network. A private IP address requires a specific password. Only users who have the password can use that connection.


What is a sentence using the word justify?

Employees must justify any expenses of company funds. The standard of Western typing is to justify text to the left margin.


What are access modifiers in Java?

One of the techniques in object-oriented programming is encapsulation. It concerns the hiding of data in a class and making them available only through its methods. In this way the chance of making accidental mistakes in changing values is minimized. Java allows you to control access to classes, methods, and fields via so-called access modifiers. The access to classes, constructors, methods and fields are regulated using access modifiers i.e. a class can control what information or data can be accessible by other classes. To take advantage of encapsulation, you should minimize access whenever possible.Java provides a number of access modifiers to help you set the level of access you want for classes as well as the fields, methods and constructors in your classes. A member has package or default accessibility when no accessibility modifier is specified.Access Modifiers1. Private2. Protected3. Default4. PublicPublic is the most liberal access modifier and Private is the most restrictive access modifier.Note: there is no such thing as an 'access specifier' in Java, only access modifiers.


Do you have to justify using money in your bank account?

You do not have to justify using money in your bank account unless you are in the middle of a bankruptcy and someone is overseeing what you are doing. There are few occasions where you have to divulge this type of information.


How did Europeans justify using Africans as slaves?

ehh nig


How can you get a remote access?

You can get remote access to your company's network by using something like VPN (Virtual Private Network). Which will give you remote access to business files so that you don't have to take them all with you. Contact your IT department and they should be able to help get this set up on your computer.


How does a class enforce data-hiding in C plus plus?

In c++, data hiding is enforced in classes using private data members !!! it means that we cant directly access the private data members of a class.


Define access specifiers in object oriented programming?

One of the techniques in object-oriented programming is encapsulation. It concerns the hiding of data in a class and making them available only through its methods. In this way the chance of making accidental mistakes in changing values is minimized. Java allows you to control access to classes, methods, and fields via so-called access modifiers. The access to classes, constructors, methods and fields are regulated using access modifiers i.e. a class can control what information or data can be accessible by other classes. To take advantage of encapsulation, you should minimize access whenever possible.Java provides a number of access modifiers to help you set the level of access you want for classes as well as the fields, methods and constructors in your classes. A member has package or default accessibility when no accessibility modifier is specified.Access Modifiers1. Private2. Protected3. Default4. PublicPublic is the most liberal access modifier and Private is the most restrictive access modifier. NB there is no such thing as an 'access specifier' in Java, only access modifiers.


What is encapsulation explain with an example?

Encapsulation is also known as information hiding, it is to protect data from the client using the classes but still allowing the client to access the data, but not modify it. Through a public interface, the private data can be used by the client class without the worry of the user messing with the private data. An example of encapsulation is declaring an instance variable private, and having an accessor method that allow access to the variable.


Visibility control in java?

Visibility control in Java is implemented using Access Modifiers. An Access Modifier is a key word in java that determines what level of access or visibility a particular java variable/method or class has. There are 4 basic access modifiers in java. They are: 1. Public 2. Protected 3. Default and 4. Private Private is the most restrictive access modifier whereas public is the least restrictive. Default is the access protection you get when you do not specifically mention an access modifier to be used for a java object.


A sentence using the word access?

I have complete access to the archives.


Is it possible to do the research without literature and literature survey justify the answer with suitable writeup?

Yes, it is possible to do the research without literature and justify your answer using a suitable write up.


How can you get someone's insurance information online?

You wont be able to access anyone's private insurance information online, or anywhere else for that matter. This information is considered private. Any attempt to obtain this type of information using fraudulent means would be punishable by law.