Ask Question
13 November, 13:11

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?

+1
Answers (1)
  1. 13 November, 14:01
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers