Question: Choose the best prototype for a method to input an object of the class Rational from the user. (Recall that a rational number - or

Choose the best prototype for a method to input an object of the class Rational from the user. (Recall that a rational number - or improper fraction - has a numerator and denominator: 1/2, -4/5, 7/3, 6, etc.) But not 3 2/3 nor 0.96. A) Rational Rational:: input (void) const: B) Rational Rational:: input(void): C) bool Rational:: input(void): D) bool Rational:: input(long & numer, long & denom) const: E) bool Rational:: input(Rational & rat) const: Now show a typical call to the method whose prototype you chose above. (Typical meaning how you should use it in a program that needed to input a Rational number.) (Include any necessary declarations or other statements for it to work.) The purpose of an accessor method in a class is ______ A) allowing the caller direct access to a private data member of the class B) allowing the caller to view a copy of the value in a private data member of the class C) allowing novel usage patterns not conceived of by the class programmer D) allowing the caller to change the private data members of a class E) singing The purpose of a mutator method in a class is _____. A) encapsulating any error checking and/or validity checking codes necessary to ensure that the class' data members are not butchered, garbled, or otherwise messed up/destroyed B) allowing the caller to view the private data member s current value C) allowing the caller to perform controlled changes to the specified private data member of the class D) allowing novel usage patterns not conceived of by the class programmer E) dancing A class' copy constructor is automatically called in three (3) situations. What/When are they? A) when one object (which already exists) is assigned to be an exact copy of another object (which also already exists) B) when one object is declared and at the same time initialized with another object that already exists C) when a function accepts an argument using the value mechanism, the formal argument is copy constructed from the actual argument D) when a function returns its result using the value mechanism, the result given back to the caller is copy constructed from the value of the return expression E) when the programmer forgets to initialize a newly declared object to a particular value/state In relation to other parts of a program, where would a class definition be placed? What about the definitions of [non-inline) class methods

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!