Ask Question
26 August, 01:35

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. 26 August, 03:21
    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?
Find 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 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