Should every class that is only used once be static?
<p>I've seen various discussions about this and I suppose it may be a bit opinion based, but what I'm trying to find out is if I know I will only use a class once (one instance), should I just make it static for convenience? Is that bad practice or will it create a problem?</p><p>For example. If I make a single player game, there will only be one player at all times. So do I make <code>public static class Player{}</code> or do I stick with <code>public class Player{}</code> <code>Player player = new Player();</code></p><p>The idea is that this would save time by not needing to pass around references.</p><br /><h2>Click here view more answers <a href="%20http://stackoverflow.com/questions/34525801/should-every-class-that-is-only-used-once-be-static">http://ift.tt/1VpgqNI</a></h2>
Nhận xét
Đăng nhận xét