Database Programming
Java Programming
C Programming
C Sharp

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

666768

Top Answer
User Avatar
Wiki User
2009-09-04 13:28:33
2009-09-04 13:28:33

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.

1
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0

Related Questions

User Avatar

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

User Avatar

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.

User Avatar

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.

User Avatar

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

User Avatar

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.

User Avatar

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

User Avatar

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.

User Avatar

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".

User Avatar

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.

User Avatar

โ€ข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.

User Avatar

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.

User Avatar

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

User Avatar

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

User Avatar

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.

User Avatar

What is the valid class declaration header for the derived class d with base classes b1 and b2?A. class d : public b1, public b2 {/*...*/};B. class d : class b1, class b2 {/*...*/};C. class d : public b1, b2 {/*...*/};D. class d : b1, b2 {/*...*/};The answer is A, C and D.B is not valid because "class" is not a valid access specifier.All the others are valid because private access is the default when the access specifier is omitted. Note that if class D were declared using the struct prefix, inheritance would default to public access rather than private.

User Avatar

It isn't. Private is the default access for class members. For struct members, the default access is public. Aside from default access, a class and a struct serve the same purpose; to define a class. As such, the following class definitions are equivalent: class X { int a; }; struct Y { private: int b; }; Typically, we use a struct to define simple data types with trivial construction and use class for more complex data types, often to encapsulate an invariant or to acquire a resource, hiding the implementation details from consumers using private access.

User Avatar

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.

User Avatar

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.

User Avatar

Visibility Control is achieved in Java by 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.

User Avatar

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.

User Avatar

1)"this" refers to the current class where as "super" refers directly to its immediate above super class. 2)private variables cannot be accessed in a inherited class by using "this",where as by using "super" we can easily access the private variables in its super class.

User Avatar

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.

User Avatar

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.

User Avatar

> How do you access a pointer using structure Not possible. > and write a program using that Do write.


Copyright ยฉ 2020 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.