Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Do the following in c++ Suppose your program contains the following class defini

ID: 3696531 • Letter: D

Question

Do the following in c++

Suppose your program contains the following class definition, and suppose the main function of your program contains the following declaration and that the program somehow sets the values of all the member variables to some values: Which of the following statements are then allowed in the main function of your program? Suppose you change Self-Test Exercise 2 so that in the definition of the class Car all member variables are public instead of private. How would this change your answers?

Explanation / Answer

The following statements are allowed

toyota.setPrice(3000.97);
double aPrice,aProfit;
aPrice=toyota.getPrice();
ford = toyota;

The other statements are not allowed as those are private in that context and we will be getting error for those statements..

WHen all the members are made as public, all the statements are allowed in tha main.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote