| <<< A pointer to rectangle name | Index | Rectangle name setter and getter functions >>> |
Newly added data members usually require changes in existing constructors
Each constructor of the Rectangle struct must be updated to accommodate and initialize the ptr_name pointer:
struct Rectangle {
int width; // member variable
int height; // member variable
char const* ptr_name;
Rectangle()
{
width = 1;
height = 1;
ptr_name = "UNKNOWN";
}
Rectangle( char const* ptr_name_, int width_ )
{
width = width_;
height = width_ ;
ptr_name = ptr_name_;
}
Rectangle( char const* ptr_name_, int width_ , int height_ )
{
width = width_;
height = height_;
ptr_name = ptr_name_;
}
//...
};//struct Rectangle
| <<< A pointer to rectangle name | Index | Rectangle name setter and getter functions >>> |