Virtual Functions and Multiple Inheritance
摘要
As a lazy programmer, I’m all about not rewriting code in all those subclasses I made. Consider the function draw for the various Shapes. Every time I draw, I should be sure I’m using the Shape’s color. I don’t want Circle::draw, Rectangle::draw, etc. to all have to do this separately – if nothing else, I’ll forget. So let’s adapt Shape so it can remember: