How will a class protect the code inside it?
a) Using Access specifiers
b) Abstraction
c) Use of Inheritance
d) All of the mentioned
Answers
Answered by
0
Answer:
a.Using Access specifer.
Explanation:
Hope it will help you..
Answered by
0
A class will protect the code inside it by using access specifiers. (Option a)
- Access specifiers specify how a class's members, its attributes and methods can be accessed.
- The members in the aforementioned example are public, making it possible for outsiders to access and alter them.
- Which programme elements are permitted access to a given variable or other piece of data is determined by an access specifier, which is a defining code element.
- Three access specifiers are available in C++: Public members can be accessed outside of the class.
- Private members are those who cannot be accessible (or seen) by anybody outside the class.
- Members that are protected cannot be accessible from outside the class but can be accessed from inherited classes. Public, protected, default, and private are Java's four access modifiers.
Hence, a class will protect the code inside it by using access specifiers.
#SPJ3
Similar questions
Accountancy,
4 months ago
Math,
4 months ago
Math,
4 months ago
Sociology,
8 months ago
Math,
8 months ago