Ask Question
2 August, 07:37

Consider a Rational class designed to represent rational numbers as a pair of ints, along with methods reduce (to reduce the rational to simplest form), gcd (to find the greatest common divisor of two ints), as well as methods for addition, subtraction, multiplication, and division. Why should the reduce and gcd methods be declared to be private?

A. because they will never be used

B. because they will only be called from methods inside Rational

C. because they will only be called from the constructor of Rational

D. because they do not use any of the Rationalinstance data

E. This is incorrect; they should be declared as public

+3
Answers (1)
  1. 2 August, 09:39
    0
    Option B is the correct answer to the following question.

    Explanation:

    Because the data members and the member functions are declared with the private access modifier so they are unable to access from outside the class even they are the data members or the member functions. then, all the members of the class can only call through the other method of relational then, they has to be declared with the private access modifier.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Consider a Rational class designed to represent rational numbers as a pair of ints, along with methods reduce (to reduce the rational to ...” 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