Tuesday, May 18, 2010

Lugaru - Part 4.1

As a quick addendum to Part 4, I realize that enumerations can't be used for every constant since enum values can only be integer types. The gravity constant example I used in the previous post would need to be represented as a const float.

Also, for further reading on this, I'd point you to Scott Meyer's "Effective C++ Third Edition" Item 2, "Prefer consts, enums, and inlines to #defines"

And for you eager beavers that want to start reading on the polymorphic weapon heirarchy, check out "Refactoring - Improving the Design of Existing Code" by Martin Fowler. Specifically, the section on Switch Statements in chapter 3 "Bad Smells in Code" and "Replace Type Code with Subclasses" in Chapter 8.

No comments: