answersLogoWhite

0

False. Public member data is accessible to all functions, whether they be public, protected or private members of the same class, or they are outside of the class completely.

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

What are different ways by which you can access public member functions of an object?

You simply access it. That's what public means. You can access a public member from any other class, or even from non class code, so long as the referenced class is in scope to the referencing code. In order to do that, you need to have a reference (directly or indirectly) to the instance of the class you want to reference. This would generally be passed as an argument to the referencing code.


What kinds of access can a class member have?

Public, protected and private access members.


What in Online Public Access catalog functions?

to provide the library with more information


How can you access private functions of a class from the Main function in Cpp?

Any member functions and data members declared as 'private' in a class, can only be accessed directly by functions within the class.They cannot be accessed directly by derived objects, nor from anywhere outside an object of the class, such as from the Main function.To access private class members, you must rely on what are called accessor functions. Accessor functions are functions inside the class, either public or protected, which automatically have access to private members.If a function from Main, or elsewhere outside the class hierarchy, needs access, then you need to use publicaccessor functions. For derived class access, you can use protected accessor functions.


Which base class member functions are not inherited by a derived class?

Derived classes only inherit the protected and public members of their base classes. Private member functions cannot be inherited by a derived class.

Related Questions

What are different ways by which you can access public member functions of an object?

You simply access it. That's what public means. You can access a public member from any other class, or even from non class code, so long as the referenced class is in scope to the referencing code. In order to do that, you need to have a reference (directly or indirectly) to the instance of the class you want to reference. This would generally be passed as an argument to the referencing code.


What do you mean by access specifier in c?

There are no access specifiers in C. All functions and data are public.


What kinds of access can a class member have?

Public, protected and private access members.


What in Online Public Access catalog functions?

to provide the library with more information


How can you access private functions of a class from the Main function in Cpp?

Any member functions and data members declared as 'private' in a class, can only be accessed directly by functions within the class.They cannot be accessed directly by derived objects, nor from anywhere outside an object of the class, such as from the Main function.To access private class members, you must rely on what are called accessor functions. Accessor functions are functions inside the class, either public or protected, which automatically have access to private members.If a function from Main, or elsewhere outside the class hierarchy, needs access, then you need to use publicaccessor functions. For derived class access, you can use protected accessor functions.


What does In public mean?

The keyword public is an access specifier. A variable or a method that is declared public is publicly accessible to any member of the project. Any class or method can freely access other public methods and variables of another class.


Difference friend and public access modifier?

In C++, a friend function or friend class can grant access to its private data members to other classes. The public member allows any class to access that data.


Which base class member functions are not inherited by a derived class?

Derived classes only inherit the protected and public members of their base classes. Private member functions cannot be inherited by a derived class.


When do you use the protected access specifier on a class member in c plus plus?

You use the protected access specifier to allow a derived class implementer access to what would otherwise be a private member method of your class. Private member methods are intended for internal use only, however some may be optimised versions of public member functions. Public member functions, particularly accessors (getters) and mutators (setters), often contain additional runtime checks that are usually redundant to the internal implementation. While we may not wish to allow "ordinary" users access to these optimised functions, derived class implementers are not ordinary users. Like you (the class designer) they want to create an efficient implementation and would therefore benefit from having access to your private implementations, or at least some of them. We achieve this by declaring those methods protected. Note that although you can also allow class implementers protected access to your otherwise private member data, this is not recommended as class implementers would then be able to undermine your data encapsulation. Class representations must remain private to maintain encapsulation. Similarly, any private methods that have potential for undermining encapsulation should likewise remain private.


What is meant by public facilities?

Public facility means that anybody can use it - e.g. a public restroom/toilet, public phone, public park, etc. You don't need to be a member or someone special to get access.


What are the Functions of public communication?

Functions of public communication


How can I gain access to Club 33?

Access to Club 33, a private club at Disneyland, is limited and exclusive. Membership is by invitation only, and there is a waitlist to join. To gain access, you would need to be invited by a current member or be a member of a corporate sponsor. It is not open to the general public.