Question: What is the output? #include #include using namespace std; class Movie { public: int rating = 1 ; void Print ( ) { cout <

What is the output?
#include
#include
using namespace std;
class Movie {
public:
int rating =1;
void Print(){
cout << "Rating: "<< rating <<" stars" << endl;
}
};
bool operator!=(const Movie& lhs, const Movie & rhs){
return (lhs.rating != rhs.rating);
}
int main(){
Movie movie1;
Movie movie2;
int currentRating;
movie1.rating =4;
movie2.rating =5;
if (movie1!= movie2){
movie1.Print();
}
else {
movie2.Print();
}
return 0;
}

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 Programming Questions!