answersLogoWhite

0


Best Answer

There is no such thing as visibility mode in C++. Visibility is a function of information hiding but that relates to the way in which implementation details can be obfuscated within binary executables and libraries where only the interface need be exposed in a plain-text header file. This has nothing whatsoever to do with object oriented programming since information hiding is also possible in C.

You probably meant access specifiers. There are three levels: private, protected and public. Private access limits access to the class and to friends of the class. Protected is the same as private but extends access to derivatives of the class. Public access imposes no limits.

In terms of inheritance, the specified access level determines the accessibility of the protected and public members of the base class (private members are never inherited and will always remain private to the base class). in essence, members with access greater than the specified inheritance are reduced to the specified access. Thus if you specify protected inheritance, all public members of the base class become protected members of the derivative, while private inheritance reduces all public and protected members to private access. You may also reduce access to specific base class members simply be redeclaring them with the appropriate access.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

10y ago

Visibility mode relates to inheritance and how base classes are viewed with respect to the derived class.

When one class inherits from another, it automatically inherits all the public and protected members of the base class (private members are never inherited and therefore play no part in visibility mode). The visibility modes available are the same as those used to specify access: public, protected and private. When not specified, private visibility is the default for class types while public is the default for struct types.

Whichever mode you specify (or imply), any base class member with greater or equal access is reduced to the specified visibility. You cannot use visibility to increase member access above that specified by the base class, it can only be reduced or kept the same.

Thus private inheritance renders all public and protected members of the base class as private members of the derived class. Protected inheritance renders all public members of the base class as protected members of the derived class. Public inheritance has no effect on the visibility of base class members.

The visibility mode is specified for the class as a whole through the inheritance declaration. However, you can also specify the visibility for individual base class members by unambiguously redeclaring them within the appropriate private, protected or public sections of the derived class. For instance, you might use public inheritance for the class as a whole but reduce one or more public members to protected or private visibility, and/or reduce some protected members to private visibility.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

We do not use the terms super class and sub class, we use the terms derived class and base class, respectively. We also use the term accessibility rather than visibility.

The accessibility of base class members is determined by the type of inheritance specified:

  • Public inheritance has no effect on the base class members.
  • Protected inheritance changes public members of the base class to protected members of the derived class.
  • Private inheritance changes both public and protected members of the base class to private members of the derived class.

Note that the accessibility of individual public or protected base class members can be overridden regardless of the type of inheritance specified. However, private members of the base class are never inherited by the derived class and so are not affected by the type of inheritance.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

We do not use the terms super class and sub class, we use the terms derived class and base class, respectively. We also use the term accessibility rather than visibility.

The default accessibility of base class members is determined by the type of inheritance specified:

  • Public inheritance has no effect on the base class members.
  • Protected inheritance changes public members of the base class to protected members of the derived class.
  • Private inheritance changes both public and protected members of the base class to private members of the derived class.

Note that the accessibility of individual public or protected base class members can be overridden regardless of the default type of inheritance specified. However, private members of the base class are never inherited by the derived class and so are not affected by the type of inheritance.

This answer is:
User Avatar

User Avatar

Wiki User

7y ago

There are no visibility modes in C++. You are probably referring to accessibility. The three levels of accessibility are private, protected and public, and apply to both members and to base classes.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

visibility modes in c++

1. privet

2.protected

3.public

4.friend

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is visibility mode what are the different inheritance visibility modes support by c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the probable mode of inheritance from a pedigree diagram showing phenotypes?

The modes of inheritance are y-linked, x-linked, and mitochondrial. Inherited traits can then be recessive, dominant, or autosomal depending on how they are inherited.


What types of multiplayer game modes does the software offer?

Different games have different multiplayer modes, or no multiplayer mode at all. You need to refer to the products manual to determine the different game modes.


What are the addressing modes of an Intel core I3 support?

ds


What are the different modes of transportation?

CarsMotorcycleBusBicycleTrainAir Planes


What are the different types of drama modes?

ut7udk6rftghtyuijkl


What are different modes of transportation?

CarsMotorcycleBusBicycleTrainAir Planes


What are the five different modes of transportation at Chicago Hare international Airport?

Five different modes of transportation are airplane, bus, car, train, and walking.


Instead of banning certain modes altogether Aristotle recognized that modes could be used for different reasons He praised a certain mode for its ability to settle the mind and thought it should be?

Instead of banning certain modes altogether Aristotle recognized that modes could be used for different reason.


Which Greek Philosopher examined the importance of the modes and their effect on behavior. But rather than banning certain modes. Thought the modes should be used for different reasons. What is it?

Aristotle


Nem at least five different modes of transportation at Chicago O'Hare international Airport?

Five different modes of transportation are airplane, bus, car, train, and walking.


Instead of banning certain modes altogether Aristotle recognized that modes could be used for different reasons According to Aristotle the modes that made people stupid and should only be played?

Instead of banning certain modes altogether Aristotle recognized that modes could be used for different reason. According to Aristotle the modes that made people stupid and should only be played by Lydian and Ionian.


What different modes does it have?

BodyCraft-VR100-Rowing-Simulator has six different levels of resistance or six different modes. The first level is controlled by air resistance where as next five are with air and magnet resistance.