Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 7
    I like the answer so I voted it up but I think the code could be more elaborated. Commented Sep 18, 2008 at 17:42
  • I know, it´s just to illustrate the principle. There is plenty of accurate snippets beyong the links a reader can find in the other ansers. Commented Sep 18, 2008 at 20:31
  • 7
    +1 Great example! One tip, it worth to do stopMotor() inside a changeMotor(), just for fun :) Commented Aug 17, 2011 at 13:54
  • 7
    I suggest that you add the code for the Motor class as well, it could help understand the whole picture better. Commented Mar 11, 2015 at 5:41
  • I am curious Why there is no design pattern here? Can we apply this in real work, or because this is just an example? Commented Aug 12, 2019 at 1:34