Question about C++ and OOP.

Hi, i'm new to C++ and OOP, so I have a theorical question.

I have a class that will be used only once in the entire program. This means I will instantiate only one object from this class. So my question is:

Is it necessary to create that object? Or to put it another way:

Is it right to make a class that has only static methods and static properties?
I mean, I will never create an object. I'll use the class with static methods and static properties. For example:

1
2
3
4
5
6
7
class A
{
    static bool error;
    static bool getError(void);
    static void setError(bool);
    ....
};


Then to use:

 
if ( A::getError() ) .... ;


I hope I could express my question properly. Sorry for my English. Thanks.
Hi,
I think it is perfectly legitimate to have an all static class if it groups together common
properties and methods.

And you do not need to create an object to use it.

Hope my opinion was helpful
Shredded
Instead of a class with all static methods you should use a namespace or a singleton class
Topic archived. No new replies allowed.