Should i use classes for everything

Me and my friend started making a console game and started making classes
Is it bad or better if we make classes for everything

The Game Contains Menus Like:
Shops , Products ext ... so we thought to remove those from the main into a class, but is that better or bad ?
Last edited on
It's hard to say with that information.

When and how to use classes is actually pretty difficult for beginners to understand. They are a very confusing topic at first.


Generally a class can be used to outline a "thing" that your program interacts with. In your case, it sounds like you're creating a Menu class -- which makes sense because a Menu is a clear "thing".

As for whether or not it's a good idea.... that's hard to say. It depends on how complicated your menus are, what your class would look like, etc etc.

I would say try it both ways (with and without classes), and see which approach you like better.


EDIT: Also you probably shouldn't use classes for "everything". Overusing classes is a worse problem than not using them at all. If using them does not make writing code easier, then you probably shouldn't be using them.

The whole idea is that a class is a singular "thing" that is easy to interact with. You can write code that uses a class without having to bother with details of how the class works.

If your classes are not going to do that... and are just going to be a big series of getters/setters... then no... don't use them. At least not like that...
Last edited on
Topic archived. No new replies allowed.