subject

Given: The following if statement uses an overloaded > operator to determine whether the price of a Car object is more than $5000. Car is a struct and myCar is an object of Car. Each Car object has two variables: id (int) and price (float). As you can see in the following code, the ID of myCar is 12345 and the price is $6,000. Car myCar = {12345, 6000.};
float price = 5000;
if (myCar > price)
cout << "My car price is more than $5,000.\n";
Which one of the following function prototypes is correct syntax to overload the > operator based on the if statement above.
a. void operator>(float price);
b. bool operator>(Car& car, float price);
c. bool operator >(float amt);
d. bool operator>(Car& yourCar);
e. none of the above

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 22:00
Perform the following tasks: a. create a class named testclass that holds a single private integer field and a public constructor. the only statement in the constructor is one that displays the message “constructing”. write a main()function that instantiates one object of the testclass. save the file as testclass.cpp in the chapter 08 folder. run the program and observe the results. b. write another main()function that instantiates an array of 10 testclass objects. save the file as test class array.c . run this program and observe the results.
Answers: 1
question
Computers and Technology, 23.06.2019 06:00
What machine listens for http requests to come in to a website’s domain? a. a router b. a browser c. a server d. a uniform resource locator
Answers: 1
question
Computers and Technology, 23.06.2019 23:30
What are "open-loop" and "closed-loop" systems
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
You know the right answer?
Given: The following if statement uses an overloaded > operator to determine whether the price of...
Questions
question
Computers and Technology, 01.10.2019 06:30
question
Computers and Technology, 01.10.2019 06:30
Questions on the website: 13722361