How will a class protect the code inside it ?

Answer : A. Using access specifier

How will a class protect the code inside it ?

A. Using access specifier

B. Abstraction

C. Use of inheritance

D. All of the mentioned

Answer : A. Using access specifier

Explanation :

  • Public – The members declared as Public are accessible from outside the Class through an object of the class.
  • Protected – The members declared as Protected are accessible from outside the class but only in a class derived from it.
  • Private – These members are only accessible from within the class. No outside Access is allowed.
Leave a Reply

Your email address will not be published.