1

I am programming in c++. I have made a main class that has a bunch of member functions and variables etc. The thing is, I only really need one instance of this class, and was thinking that maybe it is unnecessary to have all the function in a class. Is it better to remove the class, and just have the functions and variables not in a class? Does in matter?

The main reason I ask is because it would simplify a bit if a the functions not in a class (becuase the member functions cant be used as arguments in other functions without making them static).

lijas
  • 466
  • 1
  • 6
  • 17
  • If you only have one instance, you probably don't need a class. Though it's hard to say without knowing what exactly you're doing, and this is more a "what's your opinion on..." kind of question, not really fit for SO. – Alex Jul 05 '15 at 20:21
  • possible duplicate of [Advantages of classes with only static methods in C++](http://stackoverflow.com/questions/7345956/advantages-of-classes-with-only-static-methods-in-c) – Piotr Siupa Jul 05 '15 at 20:22
  • If you're interacting with Java programmers a lot, then you might scare them with thoughs like this, and it might be politically expedient to make everything a class. Otherwise do whatever models the problem best. – Kerrek SB Jul 05 '15 at 20:37
  • Okey thanks. I think I skip the class. I usually program in Java so it feels a bit strange haha – lijas Jul 05 '15 at 20:47

0 Answers0