Describe the difference between a class and an object, and explain how value types and reference types are handled in memory.