Which lines contain errors?
#include <string>
using std::string;

class A { };

void operator&(int, int);       //1
void operator&(A, int) { }      //2
void operator&(int, const A&);  //3
void operator&(A, A);           //4
void operator&(A*, A*) { }      //5
Explanation
Operators can only be overloaded for non-trivial types and enum, so the first and fifth lines are incorrect.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
C++ quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes