Ask Question
21 December, 12:48

A class design requires that a particular member variable must be accessible by any subclasses of this class, but otherwise not by classes which are not members of the same package. What should be done to achieve this?

+2
Answers (1)
  1. 21 December, 14:33
    0
    The variable should be marked protected.

    Explanation:

    When class structure implies that some derived classes of such a class have to control a specific member attribute, but still not that classes which aren't members with a similar package instead. To accomplish this, the variable should be marked with protected because the protected data members are not accessed outside that class in which they are declared.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “A class design requires that a particular member variable must be accessible by any subclasses of this class, but otherwise not by classes ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers