Question - Refactoring a variable into another class?
Hi,
I hope this is the right place to post this but I was just wondering if there's a way to refactor this code to move the variable into the class without breaking too much?
The way I'm doing it is a bit janky, and I feel there's probably a much nicer way.

Thanks, Pete
Please sign in to leave a comment.
Refactoring isn't directly applicable here. Tell me more about your needs. Then I can help you find a suitable solution.
Hey thanks!
I'm talking generally, just looking to see if there's an option to move a variable into another class?
I tend to just move the variable into the class manually, then fix any errors with things that need to be relinked, is there a better way than that? No worries if not.
Thanks,
Pete
There is a refactoring called “Extract Class refactoring”, can extract the fields from a class and create a new one based on them. Also, a similar refactoring is “Extract to the Superclass”.