Answer the question
In order to leave comments, you need to log in
What is the best way to define a class?
what is the best way to declare a class, globally or inside the right blocks?
banal example written now:
class test_t
{
public:
int a;
};
/////
struct structure_t
{
test_t test;
};
//
void preset(int& val)
{
test_t test;
...
}
Answer the question
In order to leave comments, you need to log in
If the class describes a large resource-intensive object, then it is possible globally, but it is better to use the singleton pattern.
In other cases - locally.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question