C++ example: use inheritance to design draw picture function