This chapter presented the construction and operation of DC Motors and Stepper Motors. Various means of controlling these motors has also been described.
A class hierarchy was developed to represent all types of motor discussed at the beginning of the chapter. This was followed by a conceptual explanation of abstract classes and pure virtual functions. Class hierarchy’s and multiple inheritance were also explained. The need for a set of virtual destructors in a class hierarchy was also demonstrated. Unlike constructors, destructors can be virtual. These destructors are used to free an object’s dynamically allocated memory once the program no longer needs the object.
A generic program for all real motor classes of the hierarchy was developed and integrated into a main() function to demonstrate the concept and advantages of late binding. Keyboard controls were then incorporated into the program to improve control of motors when using the interface board.