+ 1
Static object importance in c++
I am aware about practical usecase of static variable like int , double etc.. Never thought of the static objects of a class.. can anyone give me practical usecase of static objects?
4 Answers
+ 2
One of the most important examples is Meyer's singleton. It uses static local variable which is an instance of class.
+ 1
You implement virtual function like value& get_curent_value(); But your implementation stores values at vector and you have to cover the case if the vector is empty.
0
some default value for case when your interface function have to return reference, but there is no real value.
0
not able to think of scenario when this situation arises