As part of making sure we have a good design, we write a simple program to draw rectangles. That works well, so we decide to add squares. We recognize that squares are just a rectangle where the width and the height must be the same. It seems like there should be some way of reusing all that code we wrote for the rectangle. One way of reusing the rectangle code in a square class is called containment.
Containment means that one of the private data members of the square class is a rectangle.
The public methods of square would simple call the public methods of rectangle to do the work. It just doesn't make sense. A square doesn't contain a rectangle, a square is a rectangle. Without any more code at all, we can use Square anywhere that we could have used Rectangle. Even though we have no code in the Square class, we can call setWidth because Square inherits that method from Rectangle.