MB6-704 · Question #15
You are developing a class named Classl that performs several calculations. One of the methods in Classl is named method 1. Other developers will create classes that inherit from Classl. You need to…
The correct answer is D. Private. Methods that are declared as private can be called only from methods in the class where the pri- vate method is declared.
Question
You are developing a class named Classl that performs several calculations. One of the methods in Classl is named method 1. Other developers will create classes that inherit from Classl. You need to ensure that methodl is available to Classl and to all of the classes that inherit Classl. The developers must not be able to call methodl from any other classes. Which keyword should you use to define methodl?
Options
- AProtected
- BPublic
- CServer
- DPrivate
How the community answered
(53 responses)- A6% (3)
- B2% (1)
- C11% (6)
- D81% (43)
Explanation
Methods that are declared as private can be called only from methods in the class where the pri- vate method is declared.
Topics
Community Discussion
No community discussion yet for this question.