Hate to pile on, but this is absolutely not the definition of functional programming.
Functional programming uses stateless, immutable transformations to contorl data flow. The second you instantiate an object with some internal properties that change in memory, you are no longer programming functionally