adplus-dvertising
frame-decoration

Question

If a class have two data members and two functions to add those two numbers and to subtract them, which among the following is most efficient if the programmer wants to implement multiplication too?

a.

Define a public function which multiplies two numbers

b.

Define a public function that returns values of two data members

c.

Define a private function which multiplies two numbers

d.

Define a private function that returns values of two data members

Answer: (b).Define a public function that returns values of two data members

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. If a class have two data members and two functions to add those two numbers and to subtract them, which among the following is most efficient if the programmer wants to implement...