+ 3
Practical use case of Static
Hi We do have static member variable and static member functions. I am aware that static member variables will not have multiple copies due to object and it will be only one class level allocation. Static member functions can only access the static members. Practical use of static function and variable is singleton design pattern as well as how many objects got created of some type. What else in terms of real example for static?
9 Antworten
+ 1
coroutines
+ 1
Ketan Lalcheta
In this article youll find and explanation and implementation
of coroutines
https://www.geeksforgeeks.org/coroutines-in-c-cpp/
0
Raul Ramirez thanks but I am not much aware about coroutines much and hence will explore and then try to corelate
0
Manav Roy[LESS ACTIVE DUE TO EXAMS] thanks.... But isn't it a good idea to use some other data structure to store objects of class student... This class can have only name as member variable and no need of static array...
0
Thanks but I would like to disagree on this use case. I am not saying that it's not correct or it's not good to do so... My main thing is that I am not comfortable with this use case of static . I might be wrong here also.
Any other use case if you would like to share ?
And once again thanks for your time, effort and help
0
Thanks Guys. One more use case I come across is to encapsulate data for a specific translation unit in c