<<< The need for struct pointer, cont. | Index | A pointer to rectangle name >>> |
Consider an "advanced" version of the rectange:
The rectangle now has to be named when it is created:
Rectangle rect( "first", 333, 222 );
Additionally, we would like to have set_name() member function that changes the name:
Rectangle rect2 = rect; // make a copy rect2.set_name( "second" );
Named graphical primitives are very useful: they can display their name as a label when shown on the screen or identify themselves during program debugging.
<<< The need for struct pointer, cont. | Index | A pointer to rectangle name >>> |