/* Using 'protected' inheritance specifier. Public and protected members of the parent class become protected. Private members stay private */ class Rectangle : protected Shape { public: void SetName(string name) { /* The child class has access to the public fields of the parent class */ this->name = name; }
void Move(int delta_x, int delta_y) { /* We have also access to the protected fields of the parent class */ this->x += delta_x; this->y += delta_y;
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment