The University of Iowa
The College of Liberal Arts and Sciences
Department of Computer Science
Lecture/Lab #11
Operator overloading (part II), enums, member access control
Is the following a valid C++ program? If so, what does it do?
int main() {
int n = 42;
int& r;
r = n;
std::cout << r << std::endl;
}
How about this one?
auto square( int n ) { return n * n; }
int main() {
int& i = 17;
std::cout << i << std::endl;
int& j = square( 2 );
std::cout << j << std::endl;
}
Define a stream output operator for type `rectangle`
Open the exercise template
Write your code, press Run to test
When you're done, grab your Repl's link and send it as a direct message to me (agurtovoy)
Click on the corresponding option in the "Lab11 exercises" poll in #general
Define a stream output operator for an enumeration type
Open the exercise template
Write your code, press Run to test
When you're done, grab your Repl's link and send it as a direct message to me (agurtovoy)
Click on the corresponding option in the "Lab11 exercises" poll in #general