<<< The need for struct pointer | Index | A named rectangle >>> |
The main() function must pass the original object by address:
int main()
{
Rectangle rect( 333, 222 );
normalize( &rect );
std::cout << "rectangle width: " << rect.width << '\n';
std::cout << "rectangle height: " << rect.height << '\n';
std::cout << "rectangle area: " << rect.area() << '\n';
return 0;
}
Recall that the & is the C/C++ "address-of" operator.
<<< The need for struct pointer | Index | A named rectangle >>> |