Ok, another update:
https://ideone.com/XCVkX
This one is much more improved and there were some changes. I'll name some:
1. Unit is no longer the base class. FactorBase is now the base class for Unit and for Prefix.
2. I think I got resolved the whole unit + memory allocation thing.
3. The class Unit provide a member variable m_prefix of type Prefix* that points to a prefix object. All prefixes are singletons and cannot be created (private constructor), so all pointers point to const objects in static variables. I did have to use a const_cast<> here so I can change the prefix at any given time. :-(
4. The class Unit now overrides GetSymbol() from FactorBase to provide prefix symbol + class symbol. Class symbol comes from a protected virtual function called GetSymbolNoPrefix().
5. I was able to implement a global operator<< for all dimension objects! Thanks to CreativeMFS.
6. Added virtual comparison operators to Dimension<T>, the base for all dimensions.
As it currently is, my design will allow to:
1. Create compound units from mathematical operations * and / once I provide those operators to the Unit class. This means I will be able to divide length by time and get speed, or mass times acceleration to get force!! :-)
2. Create a UserDefinedUnit class so users of the library can define their own units like "apples", "oranges", etc. and be able to sum apples with apples but not with oranges! This class will also allow the developer to create a base unit class like FruitUnit should he/she decides it is ok to sum apples with oranges.
Also, related thread:
http://www.cplusplus.com/forum/general/42889/.