Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the purpose of the usual access level modifiers trio private, protected, public? Select one: a. They modify the level of exposure of a

What is the purpose of the usual access level modifiers trio "private, protected, public"?

Select one:

a. They modify the level of exposure of a class attributes (variable) or methods to the "world" outside the said class. In a class C1 For C1 attributes:

  1. Private: encrypts the content of the attribute for all methods outside C1
  2. Protected: encrypts the content of the attribute for all methods outside C1 and its subclasses.
  3. Public: unencrypted value, almost like "no encapsulation".

For C1 methods:

  1. Private: callable only by other methods in C1, not inherited in subclasses, code is totally encrypted
  2. Protected: callable by other methods in C1, inherited in all its subclasses, callable by methods of C1 subclasses, code is encrypted outside the class hierarchy, readable within.
  3. Public: callable everywhere, code readable everywhere.

b. They modify the level of exposure of a class attributes (variable) or methods to the "world" outside the said class. In a class C1 For C1 attributes:

  1. Private: provide a "read protection" against any methods not member of C1.
  2. Protected: provide a "read protection" against any methods not member of C1 or its subclasses.
  3. Public: read accessible from everywhere, almost like "no encapsulation".

For C1 methods:

  1. Private: callable only by other methods in C1, not inherited in subclasses, code is totally obfuscated
  2. Protected: callable by other methods in C1, inherited in all its subclasses, callable by methods of C1 subclasses, code is obfuscated outside the class hierarchy, readable within.
  3. Public: callable everywhere, code readable everywhere.

c. They modify the level of exposure of a class attributes (variable) or methods to the "world" outside the said class. In a class C1 For C1 attributes:

  1. Private: accessible only to methods of C1.
  2. Protected: accessible to methods of C1 and all methods of its subclasses.
  3. Public: accessible everywhere, almost like "no encapsulation".

For C1 methods:

  1. Private: callable only by other methods in C1, not inherited in subclasses.
  2. Protected: callable by other methods in C1, inherited in all its subclasses, callable by methods of C1 subclasses.
  3. Public: callable everywhere.

4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions

Question

Construct the truth table for a three-input Exclusive-NOR gate.

Answered: 1 week ago